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
I think their are a lots of answer for thumbnail, But I want to add some other urls to get youtube thumbnail very easily. I am just taking some text from Asaph's answer. Here are some url to get youtube thumbnails
For the high quality version of the thumbnail use a url similar to this:
There is also a medium quality version of the thumbnail, using a url similar to the HQ:
For the standard definition version of the thumbnail, use a url similar to this:
For the maximum resolution version of the thumbnail use a url similar to this:
Hope it helps someone in near future.
Use:
Above is the link. Using that, you can find the YouTube characteristics of videos. After finding characteristics, you can get videos of the selected category. After then you can find selected video images using Asaph's answer.
Try the above approach and you can parse everything from the YouTube API.
YOUTUBE API VERSION 3 ** UP AND RUNNING IN 2 MINUTES **
If all you want to do is search YouTube and get associated properties:
2.Use below query string. The search query (denoted by q=) in the url string is stackoverflow for example purposes. YouTube will then send you back a json reply where you can then parse for Thumbnail, Snippet, Author, etc.
What Asaph said is right. However, not every YouTube video contains all nine thumbnails. Also, the thumbnails' image sizes depends on the video (the numbers below are based on one).
There are seven thumbnails guaranteed to exist:
Additionally, the two other thumbnails may or may not exist. Their presence is probably based on whether the video is high-quality.
You can find JavaScript and PHP scripts to retrieve thumbnails and other YouTube information in:
You can also use the YouTube Video Information Generator tool to get all the information about a YouTube video by submitting a URL or video id.
Another good alternative would be to use the oEmbed API which is supported by YouTube.
You simply add your YouTube Url to the oEmbed url and you'll receive a JSON including a thumbnail and the html code for embedding.
Example:
Would give you:
Read the Documentation for more Information.
If you want the biggest image from YouTube for a specific video ID, then the URL should be something like this:
Using the API, you can pick up default thumbnail image. Simple code should be something like this: