vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Mini Mods - YouTube URL Converter/Fix by BOP5 (replaces youtu.be with youtube.com) (https://vborg.vbsupport.ru/showthread.php?t=267450)

BirdOPrey5 07-25-2011 10:00 PM

YouTube URL Converter/Fix by BOP5 (replaces youtu.be with youtube.com)
 
1 Attachment(s)
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. :)

BirdOPrey5 07-26-2011 12:12 PM

Reserved.

Wonksta 07-26-2011 12:56 PM

Legend.

BirdOPrey5 07-26-2011 01:17 PM

FYI This mod does work on VB 4.x but I don't know why you would need it.

rinkrat 07-29-2011 11:08 PM

Works as advertised! Thank you, sir!

EddyMaxx 09-05-2011 01:11 PM

Great mod. Works great!

BirdOPrey5 09-25-2011 11:49 AM

Updated to version 1.1 - Fixed bug where youtube videos with dashes (-) in their ID would not be converted.

Max Taxable 09-25-2011 11:58 AM

Been using this since Day One, works great. I appreciate the work!

cstreater 11-07-2011 07:14 PM

I downloaded this mod, removed the duplicate pattern match(?), changed the embed code to display HD when available, and added the no-cookie and https option YouTube now offers. I attached the XML if you're interested.

Anyway, your converter seems to work well in conjunction with this mod, but for some reason it doesn't convert the first post of a new thread unless I edit and save it after posting.

In fact, even without my mod it still exhibits this behavior in my test environment running a clean version of vB 3.8.7.

I take it this hasn't happened to you?

BirdOPrey5 11-07-2011 07:48 PM

You are right, it wasn't converting on first posts. Looks like I had the plugin for new threads accidentally assigned to another mod so it didn't export with this mod. Uploaded version 1.2 which fixes this issue, now includes both plugins. Thanks. :up:

Edit - Had to remove your attachment, you can't redistribute other peoples mods, even if you edit them.

cstreater 11-07-2011 08:03 PM

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.

BirdOPrey5 11-07-2011 08:23 PM

You are welcome. :)

Max Taxable 11-11-2011 03:50 PM

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" ??

BirdOPrey5 11-12-2011 09:50 AM

That is true, and yes it would need a different hook- will have to investigate.

BirdOPrey5 11-12-2011 10:15 AM

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.

Max Taxable 11-12-2011 01:53 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2267235)
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.

mykkal 06-14-2012 06:47 AM

Anyway to get it to convert old posts? I've got a few thousand of them :)

BirdOPrey5 06-14-2012 10:40 AM

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.

Max Taxable 06-14-2012 12:06 PM

Cleaner is a dangerous tool though.

BirdOPrey5 06-14-2012 12:10 PM

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

cstreater 06-14-2012 02:43 PM

Good lord, now YouTube has another format they are using o_O

http://www.youtube.com/watch?v=eYLtcwBL2Po&feature=youtu.be

BirdOPrey5 06-14-2012 03:52 PM

There are quite a few YouTube URL variations depending on how you come to view the video. The short link (youtu.be) is actually the best to use (if you have this mod) because it's always consistent.

cstreater 06-14-2012 04:23 PM

Thanks, Joe.

Yeah, just figured out that they are getting it by first watching the YouTu.be link and then right clicking the video to get the link. At that point YouTube gives them the full link and then appends &feature=youtu.be to then.

Crossbow 08-19-2012 11:56 PM

Works great. Thanks for making this mod for us.. What a life saver!!

Midohash 08-21-2012 12:13 AM

Does it play the youtube videos in member's signatures?

katie hunter 10-04-2012 09:12 PM

Hi, do I need to i install AME for this to work? But it didn't work for me at all with new posts or threads :l vb 3.7.6
It just changed the url to watch?v version but the youtube is not embed within posts or threads.

BirdOPrey5 10-05-2012 05:54 PM

Well without AME YouTube video's won't embed but the URLs should still change.

katie hunter 10-05-2012 07:12 PM

Last time few years ago, i installed AME it causes high server load because my site is big, i will try to install it again and see if this happened again.

mykkal 03-15-2013 02:47 PM

This is one of the most enhancing mods I've seen.


All times are GMT. The time now is 07:45 PM.

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.01082 seconds
  • Memory Usage 1,775KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (29)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete