Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulls wrong image from YouTube, URL also incorrect in 5.1 #63

Closed
ghost opened this issue Mar 1, 2019 · 6 comments
Closed

Pulls wrong image from YouTube, URL also incorrect in 5.1 #63

ghost opened this issue Mar 1, 2019 · 6 comments

Comments

@ghost
Copy link

ghost commented Mar 1, 2019

There are a couple of issues:

  1. It looks like YouTube isn't supplying the maxresdefault file size any longer. Several online attempts to download that image result in the YouTube file not found result. The mqdefault file size is still supported.

2) In WP 5.1 - the URL to show the thumbnail as a featured image now has the URL of the site in front of it. So instead of http://img.youtube.com/vi/THE-VIDEO-ID/maxresdefault.jpg now the media file shows the siteurl in front of the thumbnail url. The result is a broken link to the thumbnail url.

I was able to change the maxresdefault to mqdefault in the php code locally, but I wasn't able to figure out how to change the url that's inserted into the media library to fetch the featured image.

@ghost
Copy link
Author

ghost commented Mar 1, 2019

A little more on this, it looks like the media_side_load function isn't completing it's job, therefore instead of the URL being
https://foo.com/wp-content/uploads/youtube_id.jpg
it is (for example)
https://foo.com/wp-content/uploads/;https://i.ytimg.com/an_webp/youtube_id/mqdefault_6s.webp?du=3000&sqp=CMiB4uMF&rs=AOn4CLAYC0zNrTLHvzbFDjTW_HiIJ53fgA

@tw2113
Copy link
Member

tw2113 commented Mar 2, 2019

  1. Yes and no. It seems like the url we're using to test some things, https://www.youtube.com/oembed?format=json&url=http://www.youtube.com/watch?v=XYZXYZ isn't including it specifically in its JSON response, but at least for a couple of videos I've tested, there still sometimes is that max version. The one that succeeded the most for me is a really recent video. The plugin also does testing to see if there is a max version, before falling back to the hqversion. We work with what we can successfully find. Not sure what you had to change to make it work on your end, but we can test ourselves if you can provide the youtube urls you are using.

  2. Not managing to recreate issue 2, with WordPress 5.1. It may be something else in your install that's having effects on things.

Willing to help check things where we can, pending some extra feedback :)

@ghost
Copy link
Author

ghost commented Mar 2, 2019

Extra feedback is once I added the PHP snippet to compensate for the 800 character limit, the problems went away :)

Don't quite know how you can account for that in the code... but it would be a nice fix. I still have a few sites on 4.9.9 but need to move them to 5.1 for security reasons soon.

@ghost ghost closed this as completed Mar 2, 2019
@tw2113
Copy link
Member

tw2113 commented Mar 2, 2019

Damn Gutenberg and their hidden markup eating up those characters.

@ghost
Copy link
Author

ghost commented Mar 2, 2019

Yeah, no doubt.
I'll just add this here for completeness (this is also on the WP repository support forum):
To solve problems with WP 5.0 and later:
Take the following code and insert into your themes functions.php (hopefully you have a child theme) or use a snippet plugin to add it globally to the site:
function reelism_larger_content_scan( $length ) { return 3200; } add_filter( 'wds_featured_images_character_limit', 'reelism_larger_content_scan' );

@tw2113
Copy link
Member

tw2113 commented Mar 2, 2019

Related #59

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant