Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons

Reply
 
Thread Tools
YouTube URL Converter/Fix by BOP5 (replaces youtu.be with youtube.com) Details »»
YouTube URL Converter/Fix by BOP5 (replaces youtu.be with youtube.com)
Version: 1.2, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: Mini Mods - Version: 3.8.x Rating:
Released: 07-25-2011 Last Update: 11-06-2011 Installs: 56
Supported Uses Plugins
Re-useable Code Translations  

Version 1.2
1.0 - Initial Release
1.1 - Bugfix
1.2 - Bugfix

This is a very simple mod that will convert any links to videos on youtu.be to full www.youtube.com URLs.

This will be done everytime a new post is created or edited.

The purpose of this mod is to allow mods like AME 2.5 to work properly with the new shorter youtu.be share URLs.

It is preferable to use the original www.youtube.com URL because it will work with video titles and retain deep embedding support.

There are no options, just import the prodct in the usual way and it is installed and working.

If you ever need to disable it, disable the product from your Product Manager in Admin CP. Or uninstall.

*THIS WILL NOT CHANGE OLD POSTS UNLESS YOU EDIT and RE-SAVE THEM*

Example:

If someone posts:

Code:
http://youtu.be/YqlzuQfTwUk
It will be converted to:

Code:
http://www.youtube.com/watch?v=YqlzuQfTwUk
before being saved. This will allow a mod like AME to convert it to an embdded video using the standard YouTube.com definition.

This mod does NOT embed videos. It is only useful if you run a mod like AME already.

This mod works on Vb 3.6, 3.7, 3.8, and 4.x.

Please Mark as Installed if you use this.

Download Now

File Type: zip YouTube URL Converter by BOP5v12.zip (1.7 KB, 286 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
mykkal, viper357

Comments
  #12  
Old 11-07-2011, 08:03 PM
cstreater cstreater is offline
 
Join Date: May 2010
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OMG thank you! The mods you've created for our forum are definitely appreciated. Youtu.be links have definitely been a pain in my side.

The other guys I work with also love your PHP script listing all the forums & ID's. Due to the size of Android, and the number of devices they keep churning out, we have way more than I'd like to admit. Anyway, that's a little off topic from this thread. Bottom line is, thanks.
Reply With Quote
  #13  
Old 11-07-2011, 08:23 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are welcome.
Reply With Quote
  #14  
Old 11-11-2011, 03:50 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey BOP5, this modification does not work in private messages, just so's ya know. Perhaps it needs a different hook location besides "postdata_presave" ??
Reply With Quote
  #15  
Old 11-12-2011, 09:50 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is true, and yes it would need a different hook- will have to investigate.
Reply With Quote
  #16  
Old 11-12-2011, 10:15 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If anyone wants this to work on PMs- go to your Admin CP -> Plugin Manager -> Add New Plugin

product: YouTube URL Converter by BOP5

hook: private_insertpm_process

title: YouTube Fix - PMs

Exec. Order: 5

Set the php code to:
PHP Code:
if (strpos($pm['message'], "youtu.be"))
{  
  
$find "#youtu\.be/([\w-]+)#";
  
$replace "www.youtube.com/watch?v=$1";
  
$pm['message'] = preg_replace($find$replace$pm['message']);

Set ACTIVE to YES and hit "Save"
This will do the conversion in PMs too. I didn't make it an update because not everyone may want to do it with PMs. One day if I add options to this product I can make it something you may enable or disable.
Reply With Quote
Благодарность от:
Max Taxable
  #17  
Old 11-12-2011, 01:53 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
This will do the conversion in PMs too. I didn't make it an update because not everyone may want to do it with PMs. One day if I add options to this product I can make it something you may enable or disable.
We can disable it in plugin manager.

Thanks for this, some of my people like to send videos via the PM system and if they used that "short" URL my embed plugin wouldn't work in PM either, they would get only the live link.

This fixes that issue nicely.
Reply With Quote
  #18  
Old 06-14-2012, 06:47 AM
mykkal's Avatar
mykkal mykkal is offline
 
Join Date: May 2007
Location: Atlanta, GA
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyway to get it to convert old posts? I've got a few thousand of them
Reply With Quote
Благодарность от:
BirdOPrey5
  #19  
Old 06-14-2012, 10:40 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately no.

Not sure how much work you're willing to do but if you install impex, there is a tool that comes with it called cleaner.php that will let you run a regex on all posts in your database. You could take the regex from the plugin in use it in cleaner.php to convert old posts.
Reply With Quote
  #20  
Old 06-14-2012, 12:06 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cleaner is a dangerous tool though.
Reply With Quote
  #21  
Old 06-14-2012, 12:10 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is- I would advise to make a full database backup before anyone actually uses it.
Reply With Quote
Reply

Thread Tools

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 10:23 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05334 seconds
  • Memory Usage 2,338KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)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
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (4)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)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