• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest Youtube Playlist URL ignore or support

SneakyDave

Well-known member
#1
This might be considered a bug, too(?)

I would like to suggest that when entering youtube URL's that contain a list tag such as:
https://www.youtube.com/watch?v=239qXZeuE4Y&list=UUtCitcCMxSmWNkVBuQ-ydOw

That the &list tag is ignored when generating a thumbnail for the embedded video, as it doesn't seem to work correctly.

Or perhaps support the list tag somehow when entering those URL's, but I'm not sure how helpful they would be in the Media Gallery.
 
Last edited:

kontrabass

Well-known member
#2
This might be considered a bug, too(?)

I would like to suggest that when entering youtube URL's that contain a list tag such as:
https://www.youtube.com/watch?v=239qXZeuE4Y&list=UUtCitcCMxSmWNkVBuQ-ydOw

That the &list tag is ignored when generating a thumbnail for the embedded video, as it doesn't seem to work correctly.

Or perhaps support the list tag somehow when entering those URL's, but I'm not sure how helpful they would be in the Media Gallery.
Here here! Very inconvenient that youtube url's with a list tag get no thumbnail. At least 50% of the youtube media uploads we get have a list tag (and no thumbnail) :(
 

Chris D

XenForo developer
Staff member
#3
It works for me...

There's really no reason why it shouldn't. As long as it is a valid media site URL, which this should be:


(It should embed automatically)

The only bit of information that is used to fetch the thumbnail is the video ID so if it gets a video ID, it will get a thumbnail and it works here:

upload_2015-1-12_10-40-16.png
 

jOOc

Active member
#4
The thumbnail were gone for me to until I uninstalled s9e Media BBCodes pack and restored the default media BB codes. After that thumbnails works OK for your link.
So maybe how @JoshyPHP's addon work with YT thumbnails is different then default.
 

Chris D

XenForo developer
Staff member
#5
If that is the case, we really have no control over modifications made to the way default media sites are processed, or additional ones that are added.

I would hazard a guess, that there may be an additional media site that kicks in when there is a list parameter in the URL. XFMG will only create thumnnails for sites it explicitly knows about, otherwise custom code would need to be developed to get the thumbnail.

See Gallery Options > Media Site Options and the files in library/XenGallery/Thumbnail for examples.
 

JoshyPHP

Well-known member
#6
There's really no reason why it shouldn't. As long as it is a valid media site URL, which this should be:
If @kontrabass uses my add-on, the YouTube playlist link from above will generate the following BBCode:
Code:
[MEDIA=youtube]id=239qXZeuE4Y;list=UUtCitcCMxSmWNkVBuQ-ydOw[/MEDIA]
...which I guess trips your thumbnail class. The same applies to links with a timestamp or any feature that is not supported by the default YouTube media site.
 

kontrabass

Well-known member
#7
If @kontrabass uses my add-on, the YouTube playlist link from above will generate the following BBCode:
Code:
[MEDIA=youtube]id=239qXZeuE4Y;list=UUtCitcCMxSmWNkVBuQ-ydOw[/MEDIA]
...which I guess trips your thumbnail class. The same applies to links with a timestamp or any feature that is not supported by the default YouTube media site.
Thanks for the input. I think I'm reading this right... so in order for youtube links with a playlist to generate thumbnails in XMG, I need to restore the default XF youtube media site code?
 

JoshyPHP

Well-known member
#8
The default YouTube media site does not support playlists at all so you'd be better off posting videos without the playlist (without &list=...) in your gallery.

If you don't care about playlists then you may reinstall the default YouTube definition and you won't know the difference. Ideally, it would be best to support both in the Media Gallery's thumbnail class. @Chris D If you want to support both, here's how I extract vars from the media key:
Code:
$vars = array('id' => $mediaKey);
if (preg_match('(^(\\w+=[^;]*)(?>;(?1))*$)', $mediaKey))
{
    foreach (explode(';', $mediaKey) as $pair)
    {
        list($k, $v) = explode('=', $pair);
        $vars[urldecode($k)] = urldecode($v);
    }
}
It handles both forms:
Code:
[MEDIA=youtube]239qXZeuE4Y[/MEDIA]
[MEDIA=youtube]id=239qXZeuE4Y;list=UUtCitcCMxSmWNkVBuQ-ydOw[/MEDIA]
 

Chris D

XenForo developer
Staff member
#9
It's not so much what the code is, we're fine with that. It's more a question as to whether we should support that in the core from the point of view that we obviously can't support everything that is "third party". Though I do appreciate your comments on some potential improvements from a while ago.

It'll probably be a different solution but I'll come up with something later.
 

Chris D

XenForo developer
Staff member
#11
This should help.

I stole most of your code @JoshyPHP seeing as it was already written, to save me some time, thanks for that ;)

However, we're not going to be changing anything in the core of XFMG for reasons stated, but this should work.

This file needs to be uploaded to a new directory that you will need to create:

library/XenGalleryThumbnails/YouTube.php

(so, create a directory named XenGalleryThumbnails and then upload the attached YouTube.php to that).

Then edit your Gallery Options > Media Site options. In the "Media Site Thumbnails" section, next to "YouTube" change the value to "XenGalleryThumbnails_YouTube".
 

Attachments

kontrabass

Well-known member
#12
This should help.

I stole most of your code @JoshyPHP seeing as it was already written, to save me some time, thanks for that ;)

However, we're not going to be changing anything in the core of XFMG for reasons stated, but this should work.

This file needs to be uploaded to a new directory that you will need to create:

library/XenGalleryThumbnails/YouTube.php

(so, create a directory named XenGalleryThumbnails and then upload the attached YouTube.php to that).

Then edit your Gallery Options > Media Site options. In the "Media Site Thumbnails" section, next to "YouTube" change the value to "XenGalleryThumbnails_YouTube".
Thanks for this Chris & Josh! I created the file, modified the Media Site options as instructed, and then I rebuilt gallery thumbnails. Any YouTube video I upload, playlist tag or not, generates a thumbnail now. (y)

There's just one oddity that I can live with: even after rebuilding thumbnails and purging the CDN, some older youtube videos have no thumbnail, even without playlist tags (see http://www.talkbass.com/media/categories/solo-bass-guitar.12/?page=3). No matter what I try I can't get a thumbnail on these. Like I said, I can live with this. All new uploads seem to generate thumbnails fine. :cool: