Programmatically determine whether a Youtube video has been taken down

后端 未结 4 1851
耶瑟儿~
耶瑟儿~ 2020-12-09 22:12

I\'m getting most of the music on Rap Exegesis from YouTube (in the form of embedded players). Unfortunately, there\'s always the risk that one of the videos I\'m using will

4条回答
  •  眼角桃花
    2020-12-09 22:52

    As well as the "yt:state tag", the OP of the video may not allow it to be embedded. If the list of songs on the front page is coming from a playlist that you maintain on YouTube, for example, then a way to make sure you aren't getting songs that aren't embeddable is to include the "&format=5" parameter when retrieving your list. E.g.

    http://gdata.youtube.com/feeds/api/playlists/8BCDD04DE8F771B2?v=2&format=5

    Also, if you are worried about country-level restrictions, then use the "&restriction=[two-letter country code]" parameter.

    See the 'Developer's Guide: Data API Protocol – API Query Parameters'.

提交回复
热议问题