Windows 8 如何从json请求中使用youtube api处理youtube删除的视频

Windows 8 如何从json请求中使用youtube api处理youtube删除的视频,windows-8,microsoft-metro,youtube-api,jsonresult,youtube-channels,Windows 8,Microsoft Metro,Youtube Api,Jsonresult,Youtube Channels,我想使用json请求从youtube api获取youtube视频。现在我使用json从youtube上获取视频。示例url中有一些已删除的视频(),但我只播放视频,而没有删除视频。是否可以使用json结果处理youtube删除的视频或其他方式 这是我获取youtube视频的代码 string getPlaylistVideoUrl = https://gdata.youtube.com/feeds/api/playlists/PLD62D6701B15FD3E1?v=2&safeSea

我想使用json请求从youtube api获取youtube视频。现在我使用json从youtube上获取视频。示例url中有一些已删除的视频(),但我只播放视频,而没有删除视频。是否可以使用json结果处理youtube删除的视频或其他方式

这是我获取youtube视频的代码

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
      }
}
string getPlayVideoURL=https://gdata.youtube.com/feeds/api/playlists/PLD62D6701B15FD3E1?v=2&safeSearch=strict&orderby=position&start-索引=1,最大结果=25,alt=json;
var webRequest=(HttpWebRequest)webRequest.Create(getplaylingvideourl);
使用(WebResponse-response=wait-webRequest.GetResponseAsync())
使用(Stream responseStream=response.GetResponseStream())
使用(StreamReader=新StreamReader(responseStream))
{
var jsonResult=reader.ReadToEnd();
var videosList=JsonConvert.DeserializeObject(jsonResult);
if(videosList.Feed!=null)
{
if(videosList.Feed.Entry!=null)
{
//向类中添加条目
}
}

提前感谢。

无法播放的视频在使用数据API的v2检索时,通常会在JSON响应中设置
app$control
元素。下面是一个在JSON响应中查找内容的示例:

"app$control": {
 "app$draft": {
  "$t": "yes"
 },
 "yt$state": {
  "$t": "This video is not available in your region.",
  "name": "restricted",
  "reasonCode": "requesterRegion"
 }
}

这就是为什么在给定的播放场景中视频可能无法播放的原因,因此缺少
app$control
不能确保视频始终可以播放。但是如果
app$control
在那里,则视频无法播放。

我解决了youtube删除视频的问题。如果您将播放列表设置为给定的youtube api Url中的trong>format=6

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;

谷歌文档中的“如果视频无法播放,则该视频的条目将不包含标签。此外,该条目可能包含