在我的iOS应用程序中,我需要支持将视频上传到YouTube.
是否可以在此应用程序中将视频上传到YouTube?如果是这样,我该如何实现呢?
我的问题不在于从一般渠道中检索视频.我只想获得频道创建的所有"播放列表",并检索每个播放列表的缩略图,标题和视频数量.
这是一个youtube频道示例:
如您所见,有许多创建的播放列表.
截至目前,我只能获得最新上传的频道视频,在这种情况下只有5个.
使用以下代码:
let urlString = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=\(playlistID)&key=\(apiKey)"
// Create a NSURL object based on the above string.
let targetURL = NSURL(string: urlString)
// Fetch the playlist from Google.
performGetRequest(targetURL, completion: { (data, HTTPStatusCode, error) -> Void in
if HTTPStatusCode == 200 && error == nil
{
// Convert the JSON data into a dictionary.
let resultsDict = try NSJSONSerialization.JSONObjectWithData(data!, options: []) as! Dictionary<NSObject, AnyObject>
print("resultsDict = \(resultsDict)")
......
}
else
{
print("HTTP Status Code = \(HTTPStatusCode)")
print("Error while …Run Code Online (Sandbox Code Playgroud)