WebDevStudios / Automatic-Featured-Images-from-Videos

If a YouTube or Vimeo video exists in the first few paragraphs of a post, automatically set the post's featured image to that vidoe's thumbnail.
33 stars 24 forks source link

Fix Youtube header content comparison #10

Closed tw2113 closed 8 years ago

tw2113 commented 8 years ago

https://wordpress.org/support/topic/need-to-update-for-404-for-youtube?replies=2#post-7749550

"Testing for HTTP/1.0 fails on Youtube. Youtube now returns HTTP/1.1.

In order to fix, change the beginning of line 59 from:

$video_thumbnail_url = $file_headers[0] !== 'HTTP/1.0 404 Not Found' ?

to:

$video_thumbnail_url = (strrpos($file_headers[0], '404 Not Found') === false) ?"

jtsternberg commented 8 years ago

@tw2113 you have commit access.

tw2113 commented 8 years ago

I patched it in a branch, but it's good practice to use issues for tracking purposes anyway :)

Waiting on fix confirmation from the original reporter.

jtsternberg commented 8 years ago

Fair enough, but I just patched it to check both ways.