Thread: Mini Mods - Auto Youtube Link-Converter
View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01386 seconds
  • Memory Usage 1,803KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • 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
  • showpost_complete