How do I get a YouTube video thumbnail from the YouTube API?

后端 未结 30 2698
Happy的楠姐
Happy的楠姐 2020-11-21 07:06

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?

30条回答
  •  名媛妹妹
    2020-11-21 07:41

    In YouTube Data API v3, you can get video's thumbnails with the videos->list function. From snippet.thumbnails.(key), you can pick the default, medium or high resolution thumbnail, and get its width, height and URL.

    You can also update thumbnails with the thumbnails->set functionality.

    For examples, you can check out the YouTube API Samples project. (PHP ones.)

提交回复
热议问题