If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the YouTube API?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Just to add/expand on the solutions given, I feel it is necessary to note that, as I had this problem myself, one can actually grab multiple YouTube videos content, in this case, thumbnails, with one HTTP request:
Using a Rest Client, in this case, HTTPFUL, you can do something like this:
a simple php function i created for the youtube thumbnail and the types are
maxresdefault
here is a simple function i created for getting the thumbnails, it is easy to understand and use. $link is the youtube link copied exactly as it is on the browser , for example https://www.youtube.com/watch?v=BQ0mxQXmLsk
This is my client-side-only no-API-key-required solution.
The code:
Utility
image.js
:Utility
url.js
:I have used YouTube Thumbnails in this way:
Remember YouTube prevents to include Images directly from their server