A better YouTube endpoint to grab media information
butchewing opened this issue · comments
The current YouTube endpoint is:
http://www.youtube.com/oembed?url={:canonical}&format=json
But, the image is only 480 x 270. It would be great if we could use:
http://img.youtube.com/vi/{:id}/maxresdefault.jpg
This would allow a much larger image (906x510).
That's right. Unfortunately, MediaEmbed is currently not as flexible as I wish. Adding a service like Grav\Plugin\MediaEmbed\Services\GitHub should be possible.
However, I strive for a complete rewrite of code base and currently collect ideas.
I ended up hacking it. I changed the thumbnail function in mediaembed/classes/OEmbed/OEmbed.php to:
public function thumbnail()
{
$thumbnail = '';
if ($this->oembed) {
$thumbnail = 'http://img.youtube.com/vi/'.$this->id().'/maxresdefault.jpg';
//$thumbnail = $this->oembed->get('thumbnail_url', '');
}
return $thumbnail;
}
It works like a charm. Take a look at the large video thumbnail here.