从 url 获取 id,即https://www.youtube.com/watch?v=DJJT0HLKtzA&list=PL10A80E048A9E16BA&index=11,这里的 id 是 DJJT0HLKtzA,您可以使用 $_GET 轻松获取。
其次,您需要使用 youtube 的 api 来获取您使用该 ID 后的数据。阅读更多关于它的信息here
或者更简单快捷的是使用 youtube 的 oEmbed(了解有关 oEmbed 的更多信息 here),即 https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=DJJT0HLKtzA&format=json 在上一个示例中使用相同的 id 返回 JSON 数据:
{
"version":"1.0",
"thumbnail_url":"https:\/\/i.ytimg.com\/vi\/DJJT0HLKtzA\/hqdefault.jpg",
"width":459,
"author_url":"https:\/\/www.youtube.com\/user\/ThatVideoMakingKid",
"provider_name":"YouTube",
"type":"video",
"provider_url":"https:\/\/www.youtube.com\/",
"title":"Evanescence-Whisper Lyrics (Fallen)",
"thumbnail_height":360,
"thumbnail_width":480,
"height":344,
"author_name":"ThatVideoMakingKid",
"html":"\u003ciframe width=\"459\" height=\"344\" src=\"https:\/\/www.youtube.com\/embed\/DJJT0HLKtzA?feature=oembed\" frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e"
}