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

后端 未结 30 3276
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:35

    YouTube API version 3 up and running in 2 minutes

    If all you want to do is search YouTube and get associated properties:

    1. Get a public API -- This link gives a good direction

    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.

      https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&maxResults=50&q=stackoverflow&key=YOUR_API_KEY_HERE

提交回复
热议问题