vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Mini Mods - Auto Youtube Link-Converter (https://vborg.vbsupport.ru/showthread.php?t=261296)

Disasterpiece 04-08-2011 06:09 PM

hm, try this one, altough it doesn't make any sense:

PHP Code:

$ytpreg "/\[youtube\]([a-zA-Z0-9_\-]+)\[\/youtube\]/i"

Quote:

Would be great if this also worked in blogs and not just forums
I'd love to, but sadly I don't know which hooks to use. I have no vbcms :(

If anyone offers me admin access to a test installation, I'm able to create a plugin for vbcms too.

BadgerDog 04-08-2011 08:30 PM

Quote:

Originally Posted by Disasterpiece (Post 2182379)
hm, try this one, altough it doesn't make any sense:

PHP Code:

$ytpreg "/\[youtube\]([a-zA-Z0-9_\-]+)\[\/youtube\]/i"


Nope?. thanks for trying .... :)

Not sure why it doesn't work, as it's opening the database now and processing it ... :confused:

Just seems to process 150,000+ posts and skips every one of them ?

Quote:

150588: Skipping...
150589: Skipping...
150590: Skipping...
150591: Skipping...
150592: Skipping...
150593: Skipping...
150594: Skipping...
150595: Skipping...
150596: Skipping...
150597: Skipping...
150598: Skipping...
150599: Skipping...
150600: Skipping...
150601: Skipping...
150602: Skipping...


FINISHED 588 runs with 0 queries

Click Here to continue?.
Imbedded BBCodes look like this ..

[youtube]FM6wHknkAPk[/youtube]
[youtube]XTGuRgcGujs[/youtube]
[youtube]Ie88A51IxY4[/youtube]

Regards,
Doug

Randomm 04-08-2011 11:25 PM

tagged
BTW can you make one with images?

Disasterpiece 04-09-2011 11:06 PM

Quote:

Originally Posted by BadgerDog (Post 2182418)
Nope…. thanks for trying .... :)

Not sure why it doesn't work, as it's opening the database now and processing it ... :confused:

Just seems to process 150,000+ posts and skips every one of them …



Imbedded BBCodes look like this ..

[youtube]FM6wHknkAPk[/youtube]
[youtube]XTGuRgcGujs[/youtube]
[youtube]Ie88A51IxY4[/youtube]

Regards,
Doug

And you clicked the link everytime until it has no queries left to run? The link is at the bottom of each page.

Otherwise I'm out of ideas.
What could help immensly is: Export only your vb posts table, put it into an archive and send it to me via PM so I can run the script myself and test out why it doesn't replace the tags.

Quote:

Originally Posted by Randomm (Post 2182469)
tagged
BTW can you make one with images?

Sure

BadgerDog 04-10-2011 09:36 AM

Quote:

Originally Posted by Disasterpiece (Post 2182798)
And you clicked the link everytime until it has no queries left to run? The link is at the bottom of each page.

Otherwise I'm out of ideas.
What could help immensly is: Export only your vb posts table, put it into an archive and send it to me via PM so I can run the script myself and test out why it doesn't replace the tags.

Yes Sir ... clicked it each time at every 10,000 posts and ran all the way through to the end ...

I'll try to figure out how to export the post table and send it to you. Never done anything like that before.

Appreciate your help .. very gracious of you ... :up:

Regards,
Doug

dealzoid 04-14-2011 05:35 PM

I'm getting 3 copies of the same video, it's a youtube rss link, before this mod I would just get a clickable image that would redirect to youtube, undesired, so any fix? or can I disable this mod just for 1 forum

the rss link is http://gdata.youtube.com/feeds/base/...rss&time=today

thanks

zelnik 04-16-2011 12:49 PM

Hey, any chance of getting this to work with the new youtu.be url structure?

Here's further info:

http://tracker.vbulletin.com/browse/VBIV-11734

BadgerDog 04-16-2011 07:43 PM

Quote:

Originally Posted by zelnik (Post 2185260)
Hey, any chance of getting this to work with the new youtu.be url structure?

Here's further info:

http://tracker.vbulletin.com/browse/VBIV-11734

Yes, that would be excellent if this mod could support this new YouTube standard ... :up:

Regards,
Doug

Disasterpiece 04-22-2011 01:45 PM

Supports new youtube links https://vborg.vbsupport.ru/

BadgerDog 04-22-2011 01:55 PM

Quote:

Originally Posted by Disasterpiece (Post 2187398)
Supports new youtube links https://vborg.vbsupport.ru/

Updated to 1.2 with thanks .. :)

Regards,
Doug

zelnik 04-22-2011 02:11 PM

Brilliant thanks!

theoutlawed 04-22-2011 03:54 PM

Good stuff, thanks for the update!

blue-c 04-22-2011 11:07 PM

excellent - works perfectly, thanks

ttran 04-24-2011 08:08 PM

HI Disasterpiece
This 1.2 works well on 4.0.8 Thank You!
I wonder if you can do this kinda code for Flickr and Photobucket Video as well? I think this would be great.
Thanks

BadgerDog 04-24-2011 09:07 PM

Quote:

Originally Posted by ttran (Post 2188240)
HI Disasterpiece
This 1.2 works well on 4.0.8 Thank You!
I wonder if you can do this kinda code for Flickr and Photobucket Video as well? I think this would be great.
Thanks

That's a really interesting idea..... :up:

Perhaps convert the Photobucket [URL] link to an [IMG] link ...

Drives me crazy when folks are too lazy (or don't know how) to do anything but post an HTTP:// link to their pic which takes them off our site.

Regards,
Doug

Disasterpiece 04-24-2011 10:44 PM

hmm, well you could. But every check costs render time the way it is now. I think this is not the appropriate way to auto-replace more than 1 particular link structure.

I coded and released this mod, because in my case, youtube links are 99% of all links which makes sense to convert them and actually improves usability. For everything else, I suggest to keep an eye out for other similar mods which cover this case.

Flickr can't be easily translated from url to embed, because it's an additional query necessary to check if the author allowed embedding, etc. So that's a bit more difficult to handle than youtube.

yin9 04-24-2011 11:50 PM

Thanks for this mod, it work with almost all videos in my forum, but I can't do that with this URL format:

http://www.youtube.com/v/2jql3tUuiFU


My forum have many videos with that format. Can you help me?

Too have many videos with spanish subdomain in URL and Without "www", but i solved this changing in RegEx "www\.youtube\.com" by ".*\youtube\.com":

Code:

/<a href=\"https?:\/\/((.*\youtube\.com\/watch\?v=)|(youtu\.be\/))([a-zA-Z0-9-_]+)(.*)?\"( target=\"_blank\")?>.*<\/a>/

Thanks in advance, greetings.

grc 05-04-2011 04:16 PM

Sorry if this has already been asked, but I don't see it....

A few users are complaining that their browser/device doesn't see the videos when they are embedded in a post. If they have the link to youtube, they can view in youtube (why is beyond me).

Anyway, is there a way that, say, beneath the video, the link to it on youtube can be shown?

Thanks for the nifty mod.

Disasterpiece 05-04-2011 07:10 PM

Quote:

Originally Posted by grc (Post 2191732)
Sorry if this has already been asked, but I don't see it....

A few users are complaining that their browser/device doesn't see the videos when they are embedded in a post. If they have the link to youtube, they can view in youtube (why is beyond me).

Anyway, is there a way that, say, beneath the video, the link to it on youtube can be shown?

Thanks for the nifty mod.

I noticed this as well, but I can't explain it yet. Fact is: The mod only replaces the link code to embed code. Maybe for special devices (iphone, smartphones in general) there is a special code necessary.
I'll check this out and keep you posted.

Disasterpiece 05-05-2011 05:57 PM

Updated to 1.3

Supports mobile devices for flash/embed-less browsers https://vborg.vbsupport.ru/

BadgerDog 05-05-2011 11:35 PM

Quote:

Originally Posted by Disasterpiece (Post 2192372)
Updated to 1.3

Supports mobile devices for flash/embed-less browsers https://vborg.vbsupport.ru/


// P.S.

Vote for me @ MOTM !
Thank you for all your support! :)

Updated to 1.3 with thanks .. :)

Continues to work fine on my computer (MacBook Pro) running FireFox, as tested with post YouTube link shown below ... :up:

Tested accessing site from my two mobile devices using this YouTube link shown in a post.

http://www.youtube.com/watch?v=9E7GLdYhm3s

iPhone 4 ... :up: (video window appears and link marked YouTube Link shows above it.)

iPad .... :down: (post is blank .. no video or link shown ... when post is edited, link above shows fine)

Hope this helps track down any problems ... :)

Regards,
Doug

Edit: Follow up.. as a test, I DISABLED mod and checked post on iPad following that. Link to YouTube video then appears in post. I ENABLED mod again and post becomes blank again... no video, no pic.

grc 05-06-2011 05:43 PM

Quote:

Originally Posted by Disasterpiece (Post 2192372)
Updated to 1.3

Supports mobile devices for flash/embed-less browsers https://vborg.vbsupport.ru/


// P.S.

Vote for me @ MOTM !
Thank you for all your support! :)

One of my guys says he now has a link:
Quote:

Hey, I *do* see a difference on my iPhone! It looks the same on my Chrome browser with a Flash-blocking plugin installed, but on my iPhone I now see a thumbnail image of the video along with a clickable link!
Thanks for the update!

Disasterpiece 05-06-2011 06:00 PM

Yes, browsers that do not support the embed/flash-functionalities, have a fallback to the youtube preview image and a link to the youtube page attached. This is the (best) standard X3 conform method i could find :)

Juggernaut 05-08-2011 06:28 AM

Voted for MOTM :D

BadgerDog 05-08-2011 09:22 AM

Anyone else tried this on the iPad?

See my post above where neither link or video appear with 1.3 ...

However, does appear fine on iPhone 4 with same Safari browser and same operating system.

Thanks ... :)

Regards,
Doug

General Zod 05-08-2011 12:12 PM

Greta mod working for me on 4.1.3

Disasterpiece 05-08-2011 03:41 PM

Quote:

Originally Posted by BadgerDog (Post 2193238)
Anyone else tried this on the iPad?

See my post above where neither link or video appear with 1.3 ...

However, does appear fine on iPhone 4 with same Safari browser and same operating system.

Thanks ... :)

Regards,
Doug

I'll test it soon on ipad, I have no access to it yet.

But as failsafe, you could change the fallback code to only image and link, so if a mobile browser is detected, don't use the default vB video embed at all.

You can accomplish this when you change the fallback embed code in the plugin's settings to this:
HTML Code:

<a href="http://www.youtube.com/watch?v=%1$s">
YouTube Video:<br /><img src="http://img.youtube.com/vi/%1$s/0.jpg" width="240" height="180" alt="Click here to view on youtube" /></a>

This ensures that the browser will display at least something instead of blank space in some cases.

BadgerDog 05-08-2011 05:58 PM

Quote:

Originally Posted by Disasterpiece (Post 2193337)
I'll test it soon on ipad, I have no access to it yet.

But as failsafe, you could change the fallback code to only image and link, so if a mobile browser is detected, don't use the default vB video embed at all.

You can accomplish this when you change the fallback embed code in the plugin's settings to this:
HTML Code:

<a href="http://www.youtube.com/watch?v=%1$s">
YouTube Video:<br /><img src="http://img.youtube.com/vi/%1$s/0.jpg" width="240" height="180" alt="Click here to view on youtube" /></a>

This ensures that the browser will display at least something instead of blank space in some cases.

Thanks ... :)

What is the name of the plugin? I can't seem to find where to put that new code exactly, or what existing code to replace ...

I'm not the brightest light bulb programmer in the room .. :D

Regards,
Doug

Disasterpiece 05-08-2011 06:11 PM

The Settings from Auto Youtube Viewer in your vB AdminCP > Settings > Auto Youtube Link Converter

I added an option in version 1.3 exactly for that purpose :)

BadgerDog 05-08-2011 06:34 PM

Quote:

Originally Posted by Disasterpiece (Post 2193382)
The Settings from Auto Youtube Viewer in your vB AdminCP > Settings > Auto Youtube Link Converter

I added an option in version 1.3 exactly for that purpose :)

Ok... :confused:

That code is exactly what's in that box right now at the last line?

Code:

<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/%1$s" width="480" height="360">
<param name="movie" value="http://www.youtube.com/v/%1$s" />
<param name="quality" value="high" />
<param name="allowFullScreen" value="true" />
<!-- Fallback content -->
<a href="http://www.youtube.com/watch?v=%1$s">
YouTube Video:<br /><img src="http://img.youtube.com/vi/%1$s/0.jpg" width="240" height="180" alt="Click here to view on youtube" /></a>
</object>

Regards,
Doug

Disasterpiece 05-08-2011 06:54 PM

Yes, that is the code which gets displayed, if a mobile browser is detected. The reason is, that mobile browsers can't potentially display the default vbulletin code, therefore nothing gets displayed.

The above code you posted is a replacement-code, which works with most mobile browsers (iphone for example). However, the ipad seems still to have trouble displaying the fallback code. So if you put the code snipped I posted a few posts above into the option field, you can ensure, that every mobile browser only displays the link instead of an embed, which he potentially can't display.

This is just a temporary solution until I figured out why the ipad can't display the fallback code and I might find a better replacement :)

BadgerDog 05-08-2011 07:20 PM

1 Attachment(s)
Quote:

Originally Posted by Disasterpiece (Post 2193392)
Yes, that is the code which gets displayed, if a mobile browser is detected. The reason is, that mobile browsers can't potentially display the default vbulletin code, therefore nothing gets displayed.

The above code you posted is a replacement-code, which works with most mobile browsers (iphone for example). However, the ipad seems still to have trouble displaying the fallback code. So if you put the code snipped I posted a few posts above into the option field, you can ensure, that every mobile browser only displays the link instead of an embed, which he potentially can't display.

This is just a temporary solution until I figured out why the ipad can't display the fallback code and I might find a better replacement :)

Ok, I did what you asked and snipped the line above and added it again under the same one that was already there, but I'm still confused as to why I need it twice. Anyway, it still doesn't appear on the iPad, but I've attached a pic of my AdminCP settings, just in case we're talking two different things here .. :D

Regards,
Doug

Disasterpiece 05-08-2011 08:20 PM

1 Attachment(s)
Not under, replace! :D

Attachment 128919

BadgerDog 05-08-2011 09:04 PM

Understood ... :D

As you've noted, it still doesn't display on the iPad (just blank post). I also checked my wife's iPad-2 and it doesn't work. Finally, I went back and checked the iPhone4 with just that single line of "FallBack Content" and it works on the one video example I posted earlier, after having removed the old code ...

Code:

<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/%1$s" width="480" height="360">
<param name="movie" value="http://www.youtube.com/v/%1$s" />
<param name="quality" value="high" />
<param name="allowFullScreen" value="true" />
<!-- Fallback content -->
<a href="http://www.youtube.com/watch?v=%1$s">
YouTube Video:<br /><img src="http://img.youtube.com/vi/%1$s/0.jpg" width="240" height="180" alt="Click here to view on youtube" /></a>
</object>

I then went through the iPhone4 and checked a few other videos that I hadn't done before, particularly some with formats that were different.

ie:

Code:

[video=youtube;W7pl0-vaCAg]http://www.youtube.com/watch?v=W7pl0-vaCAg[/video]
They didn't show up on the iPhone4 or the iPads, I guess because the format is the video BBCode used by vBulletin in a native mode?

I thought we had gone through the routine of passing the database through your utility that removed all those? .. or, was that just the mod [youtube] type ones?

Regards,
Doug

Disasterpiece 05-08-2011 09:53 PM

The script only removed those with the [youtube] tag.

The Issue I see at the moment is, that the standard vbulletin video code doesn't display on ipads, right?
> Just disable the mod, add a youtube video in a post via the vbulletin video-button, view the page and see if it appears. If not (as expected), the problem is with the embed code vbulletin uses and my mod also.
Right now I'm trying to fix that by looking for an embed code which modern browsers can display, and mobile browsers displaying some fallback thingy so they can at least see anything.

I own an iPhone 4, so I can check that, but I have to wait a few days until I get my hands on an iPad 2.

We'll see if there is something I can do, worst case will be disable the post replacement for mobile browsers completely, so they will only see a link to the youtube vid.

bad2dbone 05-09-2011 03:40 AM

it worked for the first post now it doesn't work just tired isn't converting it any idea why my other file was converted?

BadgerDog 05-09-2011 11:16 AM

Quote:

Originally Posted by Disasterpiece (Post 2193450)
The script only removed those with the [youtube] tag.

The Issue I see at the moment is, that the standard vbulletin video code doesn't display on ipads, right?

Right, but also using vBulletin's [video] function, it doesn't appear on iPhone4's.

Quote:

Originally Posted by Disasterpiece (Post 2193450)
Just disable the mod, add a youtube video in a post via the vbulletin video-button, view the page and see if it appears. If not (as expected), the problem is with the embed code vbulletin uses and my mod also.

Tried that on iPhone4 with mod ON and OFF using standard iPhone Safari browser. vBulletin's [video] function doesn't appear on iPhone4's.

Quote:

Originally Posted by Disasterpiece (Post 2193450)
We'll see if there is something I can do, worst case will be disable the post replacement for mobile browsers completely, so they will only see a link to the youtube vid.

That might be the best thing to do, but it still won't appear if people use the vBulletin [video] BBCode ...

Thanks for your efforts ... :up:

Regards,
Doug

Robbie P 05-09-2011 12:04 PM

Awesome release, thank you very much!

Disasterpiece 05-09-2011 04:22 PM

Quote:

Originally Posted by bad2dbone (Post 2193528)
it worked for the first post now it doesn't work just tired isn't converting it any idea why my other file was converted?

Do you use other modifications which edit the post-display behaviour in some way?

When you create a new post with just one or more vbulletin links (no tag, no video-embed) and view this post, do they get converted or does it stay as a link?

bad2dbone 05-09-2011 10:39 PM

stays as a link bro


All times are GMT. The time now is 01:04 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.01616 seconds
  • Memory Usage 1,863KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (21)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete