Fixed YouTube preview image not retrieved if &list is in in the URL


Well-known member
Affected version
2.2.7 PL1
When embedding a YouTube URL the preview image is not retrieved if the list parameter is included. The video itself plays fine but no preview image is retrieved.

Example #1:

This works fine in that the small preview image is shown when entering the details and when viewing it in the XFMG listing.


Example #2:

This is the same video but is part of the list. The small preview image is not shown when entering the details and no image is shown in the XFMG listing.


Here's how both them look in the XFMG listing....

Hello? 🤔

In that thread it sounds like you're referring to an actual YT list which, as you noted, is not supported by XF to be embedded. Those are links like

However, this thread is about individual songs within a list. Those can embedded and play just fine in XF. Those are links like There is no reason why a parameter within the URL should be breaking retrieving the thumbnail.
The list parameter seems to be the source of a malfunction somewhere.
Yeah, it looks like an update to the YT URL parsing over the years may have broken it.

The function matchCallback in /XF/Bbode/Helper/YouTube.php looks for the 'list' parameter and if found saves it as part of the matched media ID (so a URL like gets turned into a01QQZyl-_I, list: PLmXxqSJJq-yXrCPGIT2gn8b34JjOrl4Xf for the matched ID.​
That seems to work fine everywhere in XF since the video IDs are recognized & parsed as needed to embed the YT code and is why the actual video still plays in XFMG.​
With XFMG when retrieving the thumbnail the function getTempThumbnailPath in /src/addons/XFMG/EmbedData/YouTube.php seems to be looking for a video ID with a ":" colon in it and, if found, to parse out just the actual video ID a01QQZyl-_I when creating the thumbnail URL. So the XF devs know that the media ID could have extra data in it and to work around it to get the real ID.​
But in the example of a01QQZyl-_I, list: PLmXxqSJJq-yXrCPGIT2gn8b34JjOrl4Xf it doesn't get matched in the regex so the URL requested ends up as, list: PLmXxqSJJq-yXrCPGIT2gn8b34JjOrl4Xf/maxresdefault.jpg instead of so it of course fails.​
My guess is that the regex needs to be updated. Maybe something like (.*)(\,\.*) to parse on "," instead of the colon but this is where the XF guys know what they're doing far better than I so I'll wait & see what the patch fix looks like. :D
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XFMG release (2.2.4).

Change log:
When embedding a YouTube video, if a list parameter is included, exclude this from the URL when fetching the thumbnail image.
There may be a delay before changes are rolled out to the XenForo Community.
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XFMG release (2.2.4).
... this seems to be working as expected, thanks. đź‘Ť

(My new side project involves embedding a lot of YT videos so this fix helps.)
Top Bottom