gpt4 book ai didi

ios - 如何在 iOS 应用程序中获取 YouTube 数据?

转载 作者:行者123 更新时间:2023-11-30 12:18:48 25 4
gpt4 key购买 nike

我正在尝试构建一个包含一些 YouTube 视频的应用。我正在使用 YouTube 的 API 并使用 Alamofire 访问数据,但我尝试检索数据时出现以下错误:

{
error =
{
code = 404;

errors =({

domain = "youtube.playlist";

location = channelId;

locationType = parameter;

message = "Channel not found.";

reason = channelNotFound;

}

);
message = "Channel not found.";
};
}

这是我的viewDidLoad的内容

let API_KEY = "*********"
let UPLOADS_PLAYLIST_ID = "PL28aSZBaDzoatmISten8xeFPPuva7l8s5"
let CHANNEL_ID = "PL28aSZBaDzoatmISten8xeFPPuva7l8s5"
let parameters =["part":"snippet","channelId":CHANNEL_ID,"playListId":UPLOADS_PLAYLIST_ID,"key":API_KEY]

Alamofire.request("https://www.googleapis.com/youtube/v3/playlists", parameters: parameters, encoding: URLEncoding.default, headers: nil).responseJSON { (response) in

if let JSON = response.result.value
{
print(JSON)
}
}

最佳答案

首先去youtube找到 channel 名称并放入

 let CHANNEL_ID = "properchannel"

关于ios - 如何在 iOS 应用程序中获取 YouTube 数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45066813/

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