如何使用JSON请求中的youtube API处理youtube删除的视频 [英] How to handle youtube deleted videos using youtube api from json request

查看:164
本文介绍了如何使用JSON请求中的youtube API处理youtube删除的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用json请求从youtube api获取youtube视频.现在,我使用json从youtube获得视频.网址示例中有一些已删除的视频( http://www.youtube.com/watch ?v = MlOHWLqgcoY& list = PLD62D6701B15FD3E1 ),但我只能播放未删除的视频.是否可以使用json结果或其他任何方式来处理youtube删除的视频.

I want to get youtube videos from youtube api using json request. Now i get videos from youtube using json. Example the url have some deleted videos (http://www.youtube.com/watch?v=MlOHWLqgcoY&list=PLD62D6701B15FD3E1) but i get only playing videos not deleted videos. Is it possible or any other way to handle youtube deleted videos using json results.

这是我获取youtube视频的代码

This is my code to get youtube videos

string getPlaylistVideoUrl = https://gdata.youtube.com/feeds/api/playlists/PLD62D6701B15FD3E1?v=2&safeSearch=strict&orderby=position&start-index=1&max-results=25&alt=json;
var webRequest = (HttpWebRequest)WebRequest.Create(getPlaylistVideoUrl);
using (WebResponse response=await webRequest.GetResponseAsync())
using (Stream responseStream=response.GetResponseStream())
using (StreamReader reader = new StreamReader(responseStream))
{
   var jsonResult = reader.ReadToEnd();
   var videosList = JsonConvert.DeserializeObject<YouTubeVideosByPlaylist>(jsonResult);
   if (videosList.Feed != null)
   {
      if (videosList.Feed.Entry != null)
      {
           //Add entries to class
      }
}

谢谢.

推荐答案

我解决了youtube删除的视频问题.如果您在youtube api Url中将播放列表指定为 format = 6 .

i solve the youtube deleted videos problem. if you get the playlist to given format=6 in the youtube api Url.

string getPlaylistVideoUrl = https://gdata.youtube.com/feeds/api/playlists/PLD62D6701B15FD3E1?v=2&safeSearch=strict&orderby=position&start-index=1&max-results=25&alt=json&format=6;

这篇关于如何使用JSON请求中的youtube API处理youtube删除的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆