title: How do I get YouTube statistics from the API in c#
body: <p>How do I get YouTube video statistics? For example the: Likes, comment count, view count etc from the api. </p>
  
  <p>The following code works but the returned values dont include the statistics. </p>
  
  <p>According to the doc, I should be able to do :</p>
  
  <pre><code>var searchListRequest = youtubeService.Search.List("id,snippet,statistics");
  </code></pre>
  
  <p>but this returns an error. </p>
  
  <p>The error am getting is:</p>
  
  <blockquote>
    <p>Google.Apis.Requests.RequestError statistics [400]
    Errors[Message[statistics] Location[part -parameter]
    Reason[unknownPart] Domain[youtube.part]]</p>
  </blockquote>
  
  <p>The code is from <a href="https://developers.google.com/youtube/v3/docs/search/list" rel="nofollow">here</a>.</p>
  
  <pre><code>/*
  */   
  using Google.Apis.Auth.OAuth2;
  using Google.Apis.Services;
  using Google.Apis.Upload;
  using Google.Apis.Util.Store;
  using Google.Apis.YouTube.v3;
  using Google.Apis.YouTube.v3.Data;
  
  namespace Google.Apis.YouTube.Samples
  {
    internal class Search
    {
      [STAThread]
      static void Main(string[] args)
      {
        Console.WriteLine("YouTube Data API: Search");
        Console.WriteLine("========================");
  
        try
        {
          new Search().Run().Wait();
        }
        catch (AggregateException ex)
        {
          foreach (var e in ex.InnerExceptions)
          {
            Console.WriteLine("Error: " + e.Message);
          }
        }
  
        Console.WriteLine("Press any key to continue...");
        Console.ReadKey();
      }
  
      private async Task Run()
      {
        var youtubeService = new YouTubeService(new BaseClientService.Initializer()
        {
          ApiKey = "REPLACE_ME",
          ApplicationName = this.GetType().ToString()
        });
  
        var searchListRequest = youtubeService.Search.List("snippet");
        searchListRequest.Q = "Google"; // Replace with your search term.
        searchListRequest.MaxResults = 50;
  
        // Call the search.list method to retrieve results matching the specified query term.
        var searchListResponse = await searchListRequest.ExecuteAsync();
  
        List&lt;string&gt; videos = new List&lt;string&gt;();
        List&lt;string&gt; channels = new List&lt;string&gt;();
        List&lt;string&gt; playlists = new List&lt;string&gt;();
  
        // Add each result to the appropriate list, and then display the lists of
        // matching videos, channels, and playlists.
        foreach (var searchResult in searchListResponse.Items)
        {
          switch (searchResult.Id.Kind)
          {
            case "youtube#video":
              videos.Add(String.Format("{0} ({1})", searchResult.Snippet.Title, searchResult.Id.VideoId));
              break;
  
            case "youtube#channel":
              channels.Add(String.Format("{0} ({1})", searchResult.Snippet.Title, searchResult.Id.ChannelId));
              break;
  
            case "youtube#playlist":
              playlists.Add(String.Format("{0} ({1})", searchResult.Snippet.Title, searchResult.Id.PlaylistId));
              break;
          }
        }
  
        Console.WriteLine(String.Format("Videos:\n{0}\n", string.Join("\n", videos)));
        Console.WriteLine(String.Format("Channels:\n{0}\n", string.Join("\n", channels)));
        Console.WriteLine(String.Format("Playlists:\n{0}\n", string.Join("\n", playlists)));
      }
    }
  }
  </code></pre>