gpt4 book ai didi

javascript - 视频标题字符串 "https://youtube.com/devicesupport"的 Youtube Api 响应

转载 作者:行者123 更新时间:2023-11-28 00:18:49 25 4
gpt4 key购买 nike

对于所有视频 youtube Api 响应:

    $.getJSON( 'http://gdata.youtube.com/feeds/api/videos/'+videoID+'?v=2&alt=jsonc',
function(data){
var videoTitle = data.data.title;
//"https://youtube.com/devicesupport"
});

Youtube 更改了 API?

Append YouTube embedded video title

Getting a Youtube video title using AngularJS

jssfiddle http://plnkr.co/edit/ElWctwROCR9wdJB4KEIB?p=preview

UPD YOUTUBE API v3:

$.getJSON('http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?alt=json',function(data,status,xhr){
console.log(data.entry.title.$t);
});

但是 data.entry.title.$t = "https://youtube.com/devicesupport "

最佳答案

您的请求字符串使用的是 v=2,版本 2 已弃用。

Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information. Please use the YouTube Data API (v3) for new integrations and migrate applications still using the v2 API to the v3 API as well.

查看他们的migration guide .

看起来您希望 URL 为 source :

https://www.googleapis.com/youtube/v3/videos?part=snippet&id=gzDS-Kfd5XQ&key={YOUR_API_KEY}

另请参阅:Youtube API v3 search for videos, retrieve title and url

关于javascript - 视频标题字符串 "https://youtube.com/devicesupport"的 Youtube Api 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30217287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com