2011-12-21 6 views
0

私はWPFアプリケーションを使用していますが、YouTube APIを使用してGoogle APIとRetriving Queryを使用していますが、間違った結果が表示されます。私は間違っている私は知らないGoogle YouTubeビデオ検索キーワードが間違った結果を取得しています。?

YouTubeRequestSettings settings = new YouTubeRequestSettings("YourApplicationName", "DeveloperKey"); 
    YouTubeRequest request; 
    private const string SEARCH = "http://gdata.youtube.com/feeds/api/videos?q={0}&v=2"; 
     request = new YouTubeRequest(settings); 
     YouTubeQuery myQuery = new YouTubeQuery(string.Format(SEARCH, args.RequestedPageData.FirstOrDefault())); 
     myQuery.OrderBy = "viewCount"; 
     Feed<Video> videoFeed = request.Get<Video>(myQuery); 
     foreach (Video item in videoFeed.Entries) 
     { 
      foreach (var item1 in item.Thumbnails) 
      { 
       item.Keywords = item1.Url; 
       break; 
      } 
      VideoList.Add(new YouTubeVideoListItem() 
      { 
       Title = item.Title, 
       Description = item.Description, 
       Username = item.Uploader, 
       Thumbnail = item.Keywords, 
       NumberOfViews = item.ViewCount, 
       RunningTimeOfVideo = (Convert.ToInt32(item.Media.Duration.Seconds)/60).ToString(), 
       SearchTitle = "Search Result", 
       Posted = ((Google.GData.Client.AtomEntry)(item.YouTubeEntry)).Published.ToShortDateString(), 
       VideoUrl = item.WatchPage.AbsoluteUri 
      }); 
     } 

誰が私を更新することができ、このための周りのすべての作業があります。 greate help me。

ありがとうございます!

enter image description here

+0

検索ごとに間違った結果が表示されるのか、一部の検索結果のみに間違った結果が表示されますか? – keyboardP

+0

はいすべての検索で間違った結果が表示されています。 –

+0

何かを検索し、 'myQuery'が設定された後にブレークポイントを設定します。 'myQuery'の値をコピーしてここに貼り付けると、クエリの様子を見ることができます。 – keyboardP

答えて

0

viewCountプロパティを削除します。ビュー数が逆の順序を戻している場合があります。そのため、表示される最初の動画は、視聴回数が最も少ない動画です(通常、関連性のない動画です)。 viewCountを保持したい場合は、結果を逆方向に反復してみてください。

+0

ありがとう –

関連する問題