News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Yet Another YouTube BBCode Tag

Started by dougiefresh, December 10, 2014, 06:09:01 PM

Previous topic - Next topic

BeatsMe

Sorry if this has already been stated, too many pages to go through in three of your mods.

I have been experimenting with three of your mods, this one plus the Facebook and the Instagram one, on a test copy of my forum.  Well I have found that I am getting "Test Fail" errors when attempting to uninstall them.

Then I noticed that you have to uninstall them in the correct order so you don't get any errors... I think in the reverse order that they were installed does work.

Is this an expected behaviour with your mods ???

dougiefresh

Quote from: BeatsMe on December 07, 2015, 10:50:52 PM
Sorry if this has already been stated, too many pages to go through in three of your mods.

I have been experimenting with three of your mods, this one plus the Facebook and the Instagram one, on a test copy of my forum.  Well I have found that I am getting "Test Fail" errors when attempting to uninstall them.

Then I noticed that you have to uninstall them in the correct order so you don't get any errors... I think in the reverse order that they were installed does work.

Is this an expected behaviour with your mods ???
No problem.  My mods are written to co-exist and install nicely together, not only with my other mods but with other people's mods....  This "behaviour" you mentioned is an unfortunate side-effect of installing any kind of mods that modify the same area of code.  Each of the three mods modify a specific line in the bbcode parser so that when you use ONLY the bbcode tag with a URL in a post, it doesn't report an empty message....

BeatsMe

Quote from: dougiefresh on December 08, 2015, 03:56:36 AM
Quote from: BeatsMe on December 07, 2015, 10:50:52 PM
Sorry if this has already been stated, too many pages to go through in three of your mods.

I have been experimenting with three of your mods, this one plus the Facebook and the Instagram one, on a test copy of my forum.  Well I have found that I am getting "Test Fail" errors when attempting to uninstall them.

Then I noticed that you have to uninstall them in the correct order so you don't get any errors... I think in the reverse order that they were installed does work.

Is this an expected behaviour with your mods ???
No problem.  My mods are written to co-exist and install nicely together, not only with my other mods but with other people's mods....  This "behaviour" you mentioned is an unfortunate side-effect of installing any kind of mods that modify the same area of code.  Each of the three mods modify a specific line in the bbcode parser so that when you use ONLY the bbcode tag with a URL in a post, it doesn't report an empty message....

Sorry if i was a little too direct with my post.... i just hate having to manually remove mods that will no longer uninstall, as i have to with another mod, not one of yours.

Your mods that i have tested seem to be working well, looking to switch to yours as the other embedding mod just doesn't seem to be working with FB links for me. I guess it's no big deal if your mods need to be uninstalled in a particular order.

Anyway, great work mate  :)

dougiefresh

Quote from: BeatsMe on December 11, 2015, 05:27:27 PM
Sorry if i was a little too direct with my post.... i just hate having to manually remove mods that will no longer uninstall, as i have to with another mod, not one of yours.

Your mods that i have tested seem to be working well, looking to switch to yours as the other embedding mod just doesn't seem to be working with FB links for me. I guess it's no big deal if your mods need to be uninstalled in a particular order.

Anyway, great work mate  :)
Thanks!  Regarding manual installs: Believe me, I do understand!  I personally have 167 mods installed on my forum at XPtsp.com....  One mod that really helps me is the Sortable Packages (and Installed Times) mod.  You can list your mods by name or install date and is a BIG help, especially when you need to figure out which mod to uninstall first.... :-p

BeatsMe

Quote from: dougiefresh on December 11, 2015, 07:55:28 PM
Quote from: BeatsMe on December 11, 2015, 05:27:27 PM
Sorry if i was a little too direct with my post.... i just hate having to manually remove mods that will no longer uninstall, as i have to with another mod, not one of yours.

Your mods that i have tested seem to be working well, looking to switch to yours as the other embedding mod just doesn't seem to be working with FB links for me. I guess it's no big deal if your mods need to be uninstalled in a particular order.

Anyway, great work mate  :)
Thanks!  Regarding manual installs: Believe me, I do understand!  I personally have 167 mods installed on my forum at XPtsp.com....  One mod that really helps me is the Sortable Packages (and Installed Times) mod.  You can list your mods by name or install date and is a BIG help, especially when you need to figure out which mod to uninstall first.... :-p

Hey didn't know about that one, will look into it for sure.... thanks for the tip.


dougiefresh

#126
Uploaded v3.7 - January 23rd, 2015
o Added support for the new YouTube video playlist URLs.
o Changed regular expression to make sure "?list=", "&list=", "?v=" and "&v=" are found first.




@Dermot: Oh boy, those regular expressions were a b#$@h to modify to support those URLs!!!!  Anyways, the mod has been updated to support those YouTube URLs.  Thanks for the request!

Dermot

Quote from: dougiefresh on January 23, 2016, 09:49:14 AM
Uploaded v3.7 - January 23rd, 2015
o Added support for the new YouTube video playlist URLs.
o Changed regular expression to make sure "?list=", "&list=", "?v=" and "&v=" are found first.




@Dermot: Oh boy, those regular expressions were a b#$@h to modify to support those URLs!!!!  Anyways, the mod has been updated to support those YouTube URLs.  Thanks for the request!

Thanks for the prompt update, will check out the new build when i get home from work.

Yeah i'd say they were a regex nightmare, they don't seem to be a static number of characters either.

dougiefresh

The new playlist ID format looks like it's a 23 character string, followed by an underscore, then another 10 character string, with no spaces in between.  It differs from the 18 character string that I had found.  If there are other formats, please let me know so I can adjust the mod to attempt to properly recognize the various formats!

Dermot


Seems the list id is always 34 characters, while the start video id's are 11 which include underscores and dashes and characters can occur more than once.

Playlist ids seem to all start with PL also

some other examples


https://www.youtube.com/embed/fRh_vgS2dFE?list=PLx0sYbCqOb8Q_CLZC2BdBSKEEB59BOPUM

https://www.youtube.com/embed/oyEuk8j8imI?list=PLywWGW4ILrvpqqkgKRV8jpZMaUPohQipP

https://www.youtube.com/watch?v=09R8_2nJtjg&list=PL3VywZ6q4-UvA4PM2V-tbOdnUsmj-HLqE

https://www.youtube.com/watch?v=0KSOMA3QBU0&list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj


If i come across any other variations, I'll let you know.

Dermot

#130
speaking of regexp, perhaps this will help?


(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((?:\w|-|_){11})(?:(?:\?|\&)index=((?:\d){1,3}))?(?:(?:\?|\&)list=((?:\w|-|_){34}))?(?:\S+)?

or

(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+(?:&|&);v=))((?:\w|-|_){11})(?:(?:\?|&|&)index=((?:\d){1,3}))?(?:(?:\?|&|&)list=((?:\w|-|_){34}))?(?:\S+)?


offers index support also to the playlist url like below

https://www.youtube.com/watch?v=OPf0YbXqDm0&index=3&list=PLRBqtmUVTq9rAXBf4-j2UxDkvqt66XJP5


dougiefresh

#131
Uploaded v3.8 - January 23rd, 2016
o Modified new YouTube video playlist URLs support for better coverage.




Okay, I modified the code so that it recognizes any 34-character string that starts with a "PL" as the video playlist ID OR the 18-character string that was used as the video playlist ID....  The 34 character string is examined using a "PL[\w-]{32}" regex expression, so it should pick up on them regardless of where they drop the "-" in the ID....  Hopefully it will solve this particular problem, and yes, the new code does work with the examples given!

Regarding the "index" parameter request, I've tested with the example you gave without modifying the code and the auto-embed code already picks up on it.  I've modified the code to include the "index" parameter within the resulting HTML displayed, even though I removed it and saw no difference in the outcome....  So I'm not sure if it matters if the "index" parameter is included, but it is now anyways....

Dermot


So i finally got to installing the new build.

Playlists working fine now, great job.

one issue i noticed was the dimensions bbcode, it seems to work fine but it looks like the css for the frame div has a position issue, it's showing over the text in the post.

like i tried [youtube width=540 height=250]W54z1hwa8yM[/youtube] and video shows over the post text, absolute/relative css issue?


dougiefresh

I duplicated your bug report with the following post:
Blegh Blegh
[youtube width=540 height=250]W54z1hwa8yM[/youtube]
Blegh Blegh

Let me investigate what's going on there....

dougiefresh

Uploaded v3.9 - January 24th, 2016
o Added code to make YouTube bbcode recognize content as 34-character playlist.
o Added code to force aspect ratio of width to height to be 16:9.
o Modified CSS file so that there isn't a 25px gap at the top of the video.




@Dermot: Thanks for the bug report!  There are two issues at fault for this particular bug report.  The first is that the dimensions specified weren't in a 16:9 ratio.  I've fixed this particular issue by forcing the aspect ratio into a 16:9 ratio, which is what the CSS formats the video to.  The second issue is the 25 pixel black bar above the video, which once the ratio was fixed, still caused on overlap over the text.  That issue has been taken care of, too.....

SaltedWeb

installed fine no errors when you click on it it only puts  [youtube] nothing else.
I have no mods on the site and its running a fresh install 2.0.11 .
Removing mod for now.

Hope your surgery went well.

SW
Knowing your limitations makes you human, exceeding these limitations makes you worthy of being human.

dougiefresh

Quote from: SaltedW on February 07, 2016, 11:05:26 AM
installed fine no errors when you click on it it only puts  [youtube] nothing else.
I have no mods on the site and its running a fresh install 2.0.11 .
Hmmm.... Just installed the v3.9 mod package and it works properly, putting "[youtube][/youtube]" in the post area.....  If you have another YouTube mod installed, then this mod may conflict with that other one....

Quote from: SaltedW on February 07, 2016, 11:05:26 AM
Hope your surgery went well.
Thank you very much!  Yeah, this pain in my leg is really a non-proverbial pain...  :'(

SaltedWeb

Nope no mods what so ever actually only gives the  [youtube]
Knowing your limitations makes you human, exceeding these limitations makes you worthy of being human.

dougiefresh

I had to change the editor view mode to the WYSIWYG mode, but I did manage to duplicate the bug report.  I'm not sure what I can do about this, but let me see what I can do....

dougiefresh

UPDATE: I'm not sure that I've been helpful, but this is what I've found.....

When you are in WYSIWYG mode in SMF 2.0.x, you must put the URL of the YouTube video you want to embed in, highlight it, then press the YouTube button.  Then it will correctly surround the YouTube URL with the YouTube tags.  I'm almost sure that this is only one of the notorious WYSIWYG bugs in the SMF 2.0.x versions.

However, just for giggles, I did test under SMF 2.1, and it seems to work correctly there, so this suggests to me that using the SCEditor4SMF mod, which replaces the editor with the SCEditor code, might also solve this problem.  However, I installing that mod seems to remove any custom bbcode buttons that are added through hooks, so it may or may not be an acceptable solution to this bug report.....

Advertisement: