vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   BB Code Enhancements - Embed XHTML valid YouTube and Google Video into your posts (https://vborg.vbsupport.ru/showthread.php?t=130868)

Viper007Bond 11-04-2006 10:00 PM

Embed XHTML valid YouTube and Google Video into your posts
 
==============================
DON'T FORGET TO CLICK INSTALL!
==============================


Just thought I'd share what I did to allow my users to embed YouTube and Google Video videos into posts on my forum. This is my very first mod I've made since switching to vB, so forgive me if I screwed something up. :)


Demo:

http://forums.finalgear.com/test-for...-thread-14892/

The black bar will be different for you as it'll match your theme (it uses the same style as the whole quick reply box).


Upgrading from v1.x:

Just remove the plugin you added before (manage plugins -> delete) and then continue on to the installation instructions.

If you already have v2.x installed, you do NOT need to do this.


Installation:

Download and install the attached product. It will automatically create the new custom BBCode and add in some filtering plugins.

Save the two attached images and upload them to /images/editor/.


Usage:

Here's some examples:

Code:

[youtube]http://www.youtube.com/watch?v=hl2UUunlI2Q[/youtube]
[youtube]hl2UUunlI2Q[/youtube]
[youtube="http://www.youtube.com/watch?v=hl2UUunlI2Q"]Aston Martin Crash[/youtube]
[youtube="hl2UUunlI2Q"]Aston Martin Crash[/youtube]

Code:

[gvideo]http://video.google.com/videoplay?docid=3688185030664621355[/gvideo]
[gvideo]3688185030664621355[/gvideo]
[gvideo="http://video.google.com/videoplay?docid=3688185030664621355"]1980's Izuzu Gemini Advertisement[/gvideo]
[gvideo="3688185030664621355"]1980's Izuzu Gemini Advertisement[/gvideo]

Using vBAdvanced? It lacks the hook this plugin uses apparently, so if you wish to use this plugin with it, you need to use only the video ID and NOT the full URL for it to display correctly. Nothing I can do about it, it's vBAdvanced's fault.


How do I customize the look of the new box thingies?

Just edit the new custom BBCode items. It's in the admin area, near the bottom.

Viper007Bond 11-05-2006 10:08 PM

CHANGELOG:
  • v2.2.0: new feature -- increase video size (to 150%)
  • v2.0.2: update to YouTube video sizes to match YouTube
  • v2.0.1: minor bug in the resetting invalid BBCode calls plugin
  • v2.0.0: complete recode from the ground up!
  • v1.0.1: allow for no "www." in YouTube URLs (thanks alahnae!)
  • v1.0.0: initial release

boyrules 11-05-2006 10:43 PM

Everything Is Looking Fine ..

..but The yutube video is not showing in the post....

please fix it

abramelin 11-05-2006 10:48 PM

too much tables :/ why dont you use less tables or make tableless . if you optimize the code then it will be great.

Wachtmeister 11-05-2006 11:14 PM

Isn't it easier to define a custom vbCode?

I have one to insert Youtube Videos very easy:

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/ejOJkcs-a7s"></param><embed src="http://www.youtube.com/v/ejOJkcs-a7s" type="application/x-shockwave-flash" width="425" height="350"></embed></object>

SuperJETT 11-05-2006 11:37 PM

Very nice, installed.

Viper007Bond 11-05-2006 11:42 PM

Quote:

Originally Posted by boyrules
Everything Is Looking Fine ..

..but The yutube video is not showing in the post....

please fix it

Link me to a page where it doesn't please so I can see what's wrong. :)

Viper007Bond 11-05-2006 11:42 PM

Quote:

Originally Posted by abramelin
too much tables :/ why dont you use less tables or make tableless . if you optimize the code then it will be great.

Super simple to make it tableless. Heck, you could even just do a standard <object> and nothing else if you wanted. I just used a table to make it match most forums.

Viper007Bond 11-05-2006 11:44 PM

Quote:

Originally Posted by Wachtmeister
Isn't it easier to define a custom vbCode?

That's exactly what I did. However, via the standard vbCode, you cannnot have it accept the full video URL, only the ID. My little snippet of PHP transforms the full URL into a format that vB can handle.

Quote:

Originally Posted by Wachtmeister
I have one to insert Youtube Videos very easy:

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/ejOJkcs-a7s"></param><embed src="http://www.youtube.com/v/ejOJkcs-a7s" type="application/x-shockwave-flash" width="425" height="350"></embed></object>

Yeah, that's exactly what mine does, just with a table for style and no <embed> as that's not valid XHTML.

As said though, you can do any styling/HTML you want, it's the PHP that is the real meat of my little plugin. :)

morrow 11-05-2006 11:59 PM

Someone just posted this the other day.

https://vborg.vbsupport.ru/showthrea...hlight=youtube

Viper007Bond 11-06-2006 12:49 AM

Quote:

Originally Posted by morrow
Someone just posted this the other day.

https://vborg.vbsupport.ru/showthrea...hlight=youtube

That's just standard custom BBCode. Anyone can do that and I only provided how to do it for those who couldn't figure out how to do it themselves.

The real meat and point of this plugin is that it can accept full URLs rather than just the ID of the video. ;)

redlabour 11-06-2006 07:14 AM

Can you add wma and qt at the next Update please ? :)

Deinstalled the Plugin - to much Serverload. Take a look at the AnyMedia Code. ;)

Viper007Bond 11-06-2006 07:38 AM

Quote:

Originally Posted by redlabour
Can you add wma and qt at the next Update please ? :)

Standard custom BBCode should be enough to take care of that. Google will provide you with the needed HTML to do it. ;)

Quote:

Originally Posted by redlabour
Deinstalled the Plugin - to much Serverload.

Eh, how so? It's just a little bit of regex that's run on each post. And actually, think it only runs on new posts and is cached on old ones.

Hornstar 11-06-2006 09:52 AM

Looks good, Is there a way to enable/disable this to certain forums only tho?

Pagandream 11-06-2006 01:34 PM

great work!

bchertov 11-06-2006 06:33 PM

Great Hack! Thanks for sharing!

Maybe you can help me and possibly a few other users.

Currently I use YouTube's embed HTML to post YTs on my forum, though you hack will make it easier. It works great!

I have hacked my site to send out HTML emails of posts but the video is not shown in the html email, even though it works on the website. Is this possible? Do you know what I need to do to make it work?

Thanks!
Barry

Mecho 11-06-2006 07:38 PM

if we start to show some videos from those sites , is it use bandwidth of our server ??

Tnx

Viper007Bond 11-06-2006 09:34 PM

Quote:

Originally Posted by hornstar1337
Looks good, Is there a way to enable/disable this to certain forums only tho?

This mini-plugin just enhances the built-in custom BBCode feature to allow people to enter full URLs.

It's probably possible to write a plugin to disable certain BBCodes in certain forums, but this one is not it. ;)

Viper007Bond 11-06-2006 09:37 PM

Quote:

Originally Posted by bchertov
I have hacked my site to send out HTML emails of posts but the video is not shown in the html email, even though it works on the website. Is this possible? Do you know what I need to do to make it work?

Run the BBCode parser on your posts to get the HTML. My plugin doesn't actually do the BBCode or anything like that.

It just transforms:

[youtube]http://www.youtube.com/watch?v=9VOYF4jVo-Q&eurl=[/youtube]

to:

[youtube]9VOYF4jVo-Q[/youtube]

so that the built-in custom BBCode parser can make use of it.

fsakbas 11-07-2006 01:02 AM

thanks great job.

vivamexico55 11-07-2006 07:02 AM

How do you install this? I tried to import but it told me it was a plugin. Where do you need to attach it, and what do I fill in the fields?

Thanks =)

Dream 11-07-2006 07:36 AM

great thanks

just put a <center></center> on both and its perfect

Viper007Bond 11-07-2006 08:16 AM

Quote:

Originally Posted by vivamexico55
How do you install this? I tried to import but it told me it was a plugin. Where do you need to attach it, and what do I fill in the fields?

Thanks =)

Go to the "Download / Upload Plugins" page and scroll all the way down. ;)

vivamexico55 11-07-2006 03:30 PM

Quote:

Originally Posted by Viper007Bond
Go to the "Download / Upload Plugins" page and scroll all the way down. ;)

LOL

Sorry man, I was a bit dumb, thanks for the help =)

Viper007Bond 11-07-2006 06:36 PM

No worries. :)

McMendo 11-08-2006 06:54 PM

Since this hack uses a feature which is built in the code of vbulletin, I wonder if there is a way to embed mp2 and wmv videos hosted in the forum's server.

Quote:

Originally Posted by Mecho
if we start to show some videos from those sites , is it use bandwidth of our server ??

I'm asking myself that same question.

Processor usage I imagine that it is on the machine of the user executing the video.

Viper007Bond 11-08-2006 08:35 PM

Quote:

Originally Posted by McMendo
Since this hack uses a feature which is built in the code of vbulletin, I wonder if there is a way to embed mp2 and wmv videos hosted in the forum's server.

Standard custom BBCode without a plugin should be able to handle that since no transformation is needed. Just Google on how to embed those kinda videos. ;)

Quote:

Originally Posted by McMendo
I'm asking myself that same question.

Processor usage I imagine that it is on the machine of the user executing the video.

As said, it's YouTube or Google Video's bandwidth.

As for CPU usage, uh, I guess technically yeah, but it's just a Flash file. Flash is all over the web and is probably gonna use like 0.1% of your CPU...

alahnae 11-11-2006 12:56 AM

why does the parser work just for goolge and not for the youtube?

tested it with this
http://youtube.com/watch?v=BWW4Np5Tn0M

ogameclub 11-11-2006 10:22 AM

Thank you this great video hacks.

Viper007Bond 11-11-2006 11:26 AM

Quote:

Originally Posted by alahnae
why does the parser work just for goolge and not for the youtube?

tested it with this
http://youtube.com/watch?v=BWW4Np5Tn0M

Ah, I had hard coded "www." in. Thanks for pointing this out.

Plugin updated to make "www." optional. :)

iran.gs 11-11-2006 02:16 PM

Installed thanks so much l love it ...... xoxoxoxoxox

UK Jimbo 11-11-2006 02:52 PM

I'm using the following code for the plugin:

PHP Code:

$viper_patterns = array(
    
'#\[youtube\]http://(www.youtube|youtube).com/watch\?v=(.*?)&(.*?)\[/youtube\]#si',
    
'#\[youtube\]http://(www.youtube|youtube).com/watch\?v=(.*?)\[/youtube\]#si',
    
'#\[gvideo\]http://video\.google\.([^/]*?)/videoplay\?docid=(\d+)(.*?)\[/gvideo\]#si',
);

$viper_replacements = array(
    
'[YOUTUBE]$2[/YOUTUBE]',
    
'[YOUTUBE]$2[/YOUTUBE]',
    
'[GVIDEO]$2[/GVIDEO]',
);

$text preg_replace($viper_patterns$viper_replacements$text); 

The first change means that you can include content from local sites like video.google.co.uk, the second change (using \d+) is possible because the docid always seems to be an integer.

Viper007Bond 11-11-2006 09:00 PM

Don't forget that the Google Video ID can be negative. ;)

And I wasn't aware of Google.co.uk. I'll update and good thinking on the integer only. Thanks. :)

funkmeister 11-12-2006 05:03 AM

Great plug-in and works perfectly - thanks.

One thing - can you put update details in a revision list in the main entry post (above) for the plug-in - that way we don't have to scroll through pages of posts to find out what updates and new features have been made and added.

Thanks.

Viper007Bond 11-12-2006 07:52 AM

Quote:

Originally Posted by funkmeister
Great plug-in and works perfectly - thanks.

One thing - can you put update details in a revision list in the main entry post (above) for the plug-in - that way we don't have to scroll through pages of posts to find out what updates and new features have been made and added.

Thanks.

Uh, first real post on the first page? ;)

https://vborg.vbsupport.ru/showthread.php?t=130868#2

funkmeister 11-12-2006 02:00 PM

Quote:

Originally Posted by Viper007Bond
Uh, first real post on the first page? ;)

https://vborg.vbsupport.ru/showthread.php?t=130868#2

Ah, thanks :classic:

rex_b 11-12-2006 02:02 PM

Great hack- thank you sir

MAME 11-12-2006 03:42 PM

Youtube seemed to install fine, but googlevideo isnt showing up. Any ideas?

UK Jimbo 11-12-2006 03:44 PM

Quote:

Originally Posted by Viper007Bond
Don't forget that the Google Video ID can be negative. ;)

And I wasn't aware of Google.co.uk. I'll update and good thinking on the integer only. Thanks. :)

I looked at this for another 10 mins and think that this should do the trick for both expressions:

PHP Code:

$viper_patterns = array(
    
'#\[youtube\]http://(www.youtube|youtube).com/watch\?v=([\w]+)(.*?)\[/youtube\]#si',
    
'#\[gvideo\]http://video\.google\.([^/]*?)/videoplay\?docid=([\d\-]+)(.*?)\[/gvideo\]#si',
);

$viper_replacements = array(
    
'[YOUTUBE]$2[/YOUTUBE]',
    
'[GVIDEO]$2[/GVIDEO]',
); 

I spotted that if you preview a post the text in the editor window gets edited too which isn't ideal I guess. I wonder if there's a way of preventing that from happening?

UK Jimbo 11-12-2006 03:45 PM

Quote:

Originally Posted by MAME
Youtube seemed to install fine, but googlevideo isnt showing up. Any ideas?

I'm guessing that a link saying what BB Code you're using and a link to a post with it in would be handy for debugging.


All times are GMT. The time now is 04:43 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.01662 seconds
  • Memory Usage 1,839KB
  • 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
  • (2)bbcode_php_printable
  • (19)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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