Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Auto Youtube Link-Converter Details »»
Auto Youtube Link-Converter
Version: 1.4, by Disasterpiece Disasterpiece is offline
Developer Last Online: Oct 2019 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.1.2 Rating:
Released: 03-31-2011 Last Update: 05-22-2011 Installs: 795
Uses Plugins
Re-useable Code  
No support by the author.

So basically this is a total easy-to-implement plugin, which converts standard youtube links to video-embeds on the fly without urging users to use the video-button because I think it is unnecessary.


On post display, the plugin checks if the post contains at least 1 youtube link in the form of
Code:
<a href="http://www.youtube.com/watch?v=somecode&some=params">http://www.youtube.com/watch?v=somecode&some=params</a>
and converts them using the default vB video bbcode parser.

Code can be modified to fit your needs, altough there shouldn't be much to add.
If you're the special performance-freak, I'm curious if you can enhance data/query-performance. So let me know if you do.

INSTALL:

- Download attached XML File and import it as an addon.

Code:
Changes since 1.3:
- Now works properly on iPad

Changes since 1.2:
- Supports mobile devices with fallback-display if browser doesn't support flash/embed codes
- Allows the user to specify the above mentioned replacement code for mobile browsers
- Minor improvements & Fixes

Changes since 1.1:
- Moved regular expression and index position into admincp settings to allow easier changing in the future
- supports new youtube link format: "http://youtu.be/*somevideocode*"

Changes since 1.0: (or: why should I download that mod again?)
- Added Link parsing in post-preview mode and in post reviewbits (the latest posts you see under the new reply form)

Now every post containing youtube-links should display the embedded video instead.
Works with any number of youtube-links and any kind of text surrounding them.

Let me know if you have trouble/questions.

Download Now

File Type: xml product-autoytparser_1_1.xml (2.7 KB, 365 views)
File Type: xml product-autoytparser_1_2.xml (4.3 KB, 190 views)
File Type: xml product-autoytparser_1_3.xml (7.8 KB, 251 views)
File Type: xml product-autoytparser_1_4.xml (7.8 KB, 3453 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 04-05-2011, 01:40 AM
Juggernaut Juggernaut is offline
 
Join Date: Dec 2009
Location: California
Posts: 589
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Really useful mod
Reply With Quote
  #23  
Old 04-05-2011, 09:46 AM
Goodfather's Avatar
Goodfather Goodfather is offline
 
Join Date: Jan 2010
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed and working fine on 4.1.2
thanks

Nominated!
Reply With Quote
  #24  
Old 04-05-2011, 12:11 PM
YkudzA YkudzA is offline
 
Join Date: Feb 2011
Location: Russia
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

installed and nominated !
Reply With Quote
  #25  
Old 04-05-2011, 04:05 PM
Brandon Sheley's Avatar
Brandon Sheley Brandon Sheley is offline
 
Join Date: Mar 2005
Location: Google Kansas
Posts: 4,678
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works as it should on 4.1.2

thanks

[high]* Brandon Sheley clicks install[/high]
Reply With Quote
  #26  
Old 04-05-2011, 05:55 PM
BadgerDog BadgerDog is offline
 
Join Date: Oct 2006
Location: Toronto
Posts: 1,789
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just installed 1.1 update and testing on 4.04pl1 ....

Appears to be operating just fine ...

I like smart and intuitive add-ons that substitute for unnecessary steps for the end user and this is one of those ... :up:

Regards,
Doug

Edit: oooppps.... found a problem. Have started to get emails from members saying that they're seeing YouTube videos being duplicated in just some posts, primarily older ones. Traced cause to a conflict with a mod we've been using for 5 years which is a BBCode [youtube]xxx[/youtube] add-on to handle YouTube videos even before vb4 did with their [video]xxx[/video] button.

Any way to have this mod ignore that old mod (too many posts for us to change) and not translate, adding a second duplicate video? .. or, can we make an SQL pass on the database and change all posts to something else to be compatible with his mod?
Reply With Quote
  #27  
Old 04-06-2011, 12:34 AM
Rofo Rofo is offline
 
Join Date: Feb 2011
Location: MI,IA,WY,SC,OR,WA,XX,XX,
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works fairly well. I've noticed some YouTube links won't auto embedd. Example,

http://www.youtube.com/user/tdwpplaya - Will no embed automatically

http://www.youtube.com/watch?v=0ABGIJwiGBc - Will embed automatically.

Is it because the first link is "user"/ and not watch?v= ?

Either way, very nice Mod. This is the kinda stuff I don't understand why is not built in to the vB software. Clicking the [video] button is completely (or should be) unnecessary!
Reply With Quote
  #28  
Old 04-06-2011, 01:11 AM
Disasterpiece's Avatar
Disasterpiece Disasterpiece is offline
 
Join Date: Apr 2007
Location: GER
Posts: 765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BadgerDog View Post
Edit: oooppps.... found a problem. Have started to get emails from members saying that they're seeing YouTube videos being duplicated in just some posts, primarily older ones. Traced cause to a conflict with a mod we've been using for 5 years which is a BBCode [youtube]xxx[/youtube] add-on to handle YouTube videos even before vb4 did with their [video]xxx[/video] button.

Any way to have this mod ignore that old mod (too many posts for us to change) and not translate, adding a second duplicate video? .. or, can we make an SQL pass on the database and change all posts to something else to be compatible with his mod?
Funny that you mention that, I had exactly the same problem. We didn't use video tags, just the [youtube=title]videoid[/youtube] thingy which caused above mentioned problem.
I made a script for myself which changed all [youtube]...[/youtube] tags to full urls like
http://www.youtube.com/watch?v=*videoid*
to solve this problem. I attached it below.

USE AT YOUR OWN RISK!
Backup your database before running the query, disabling your forum might be a good idea, place it anywhere and delete it afterwards.
Edit the file before you run it with your database credentials and modify the table-prefix/name accordingly. Hit the "continue" link until the script doesn't make any more queries.
Oh and I had troubles with singlequotes in postings which messed up my query, so I simply escaped it. I didn't discover any problems with that, keep in mind that if your language makes excessive use of the ' character, you might want to find a way around that, I did not.

Will only work with old youtube tags in the form of:
Code:
[youtube]6mXM-oGggrM[/youtube]
and:
Code:
[youtube="hey check this out!"]6mXM-oGggrM[/youtube]
If you used a different tag, send me a PM and I try to help you out with the correct replacement.


Quote:
Originally Posted by Rofo View Post
Works fairly well. I've noticed some YouTube links won't auto embedd. Example,

http://www.youtube.com/user/tdwpplaya - Will no embed automatically

http://www.youtube.com/watch?v=0ABGIJwiGBc - Will embed automatically.

Is it because the first link is "user"/ and not watch?v= ?

Either way, very nice Mod. This is the kinda stuff I don't understand why is not built in to the vB software. Clicking the [video] button is completely (or should be) unnecessary!
Thanks for your feedback

The user-link will only display the profile page of the user, not a specific video. Which means, if that particlular user uploads a new video, the new video will be shown on this site. I'm not aware if the vB video tag translates this kind of url too, I find it rather unintuitive and uncommon and due to the lack of a video-ID in the url, it's not really supposed to be embedded
Attached Files
File Type: php convyt.php (1.6 KB, 14 views)
Reply With Quote
  #29  
Old 04-06-2011, 01:48 AM
Rofo Rofo is offline
 
Join Date: Feb 2011
Location: MI,IA,WY,SC,OR,WA,XX,XX,
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Disasterpiece View Post
Funny that you mention that, I had exactly the same problem. We didn't use video tags, just the [youtube=title]videoid[/youtube] thingy which caused above mentioned problem.
I made a script for myself which changed all [youtube]...[/youtube] tags to full urls like
http://www.youtube.com/watch?v=*videoid*
to solve this problem. I attached it below.

USE AT YOUR OWN RISK!
Backup your database before running the query, disabling your forum might be a good idea, place it anywhere and delete it afterwards.
Edit the file before you run it with your database credentials and modify the table-prefix/name accordingly. Hit the "continue" link until the script doesn't make any more queries.
Oh and I had troubles with singlequotes in postings which messed up my query, so I simply escaped it. I didn't discover any problems with that, keep in mind that if your language makes excessive use of the ' character, you might want to find a way around that, I did not.

Will only work with old youtube tags in the form of:
Code:
[youtube]6mXM-oGggrM[/youtube]
and:
Code:
[youtube="hey check this out!"]6mXM-oGggrM[/youtube]
If you used a different tag, send me a PM and I try to help you out with the correct replacement.



Thanks for your feedback

The user-link will only display the profile page of the user, not a specific video. Which means, if that particlular user uploads a new video, the new video will be shown on this site. I'm not aware if the vB video tag translates this kind of url too, I find it rather unintuitive and uncommon and due to the lack of a video-ID in the url, it's not really supposed to be embedded
Gotcha. Not really that big of a deal, as most YouTube links don't have that User/. Thank you for the Mod, this was a much needed one. Now if some of the other videos would auto embed!

Installed/Rated/Voted
Reply With Quote
  #30  
Old 04-06-2011, 02:38 AM
GeorgeEcuador GeorgeEcuador is offline
 
Join Date: Sep 2009
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Functional v4.03.. Fine... Installed..
Reply With Quote
  #31  
Old 04-06-2011, 01:10 PM
BadgerDog BadgerDog is offline
 
Join Date: Oct 2006
Location: Toronto
Posts: 1,789
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Disasterpiece View Post
Funny that you mention that, I had exactly the same problem. We didn't use video tags, just the [youtube=title]videoid[/youtube] thingy which caused above mentioned problem.
I made a script for myself which changed all [youtube]...[/youtube] tags to full urls like
http://www.youtube.com/watch?v=*videoid*
to solve this problem. I attached it below.

USE AT YOUR OWN RISK!
Backup your database before running the query, disabling your forum might be a good idea, place it anywhere and delete it afterwards.
Edit the file before you run it with your database credentials and modify the table-prefix/name accordingly. Hit the "continue" link until the script doesn't make any more queries.
Oh and I had troubles with singlequotes in postings which messed up my query, so I simply escaped it. I didn't discover any problems with that, keep in mind that if your language makes excessive use of the ' character, you might want to find a way around that, I did not.

Will only work with old youtube tags in the form of:
Code:
[youtube]6mXM-oGggrM[/youtube]
and:
Code:
[youtube="hey check this out!"]6mXM-oGggrM[/youtube]
If you used a different tag, send me a PM and I try to help you out with the correct replacement.
Thanks partner ... appreciate that ...

Those two BBCodes are EXACTLY the ones that we used for years, so there's a LOT of old YouTube links with them.

So, I simply execute that PHP file you attached and it will go through our entire database, altering them to something else?

I have no database prefix .... it just shows in the config file for vBulletin as ' ' with no prefix in between the single quotes. Just leave it as two single quotes in your PHP file?

BTW, my language is English ..

Regards,
Doug
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:34 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05767 seconds
  • Memory Usage 2,372KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (8)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (13)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (5)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete