Created
March 15, 2017 17:44
-
-
Save HristoKolev/7b4bdeaca44bbc8cddee67d0c2530e65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApp5 | |
{ | |
using System; | |
using System.Linq; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using TvDbSharper; | |
using TvDbSharper.BaseSchemas; | |
using TvDbSharper.Clients.Authentication.Json; | |
using TvDbSharper.Clients.Series.Json; | |
public class EntryPint | |
{ | |
public static void Main(string[] args) => new EntryPint().MainAsync(args).GetAwaiter().GetResult(); | |
public async Task MainAsync(string[] args) | |
{ | |
const int SeriesId = 267777; | |
var client = new TvDbClient(); | |
await client.Authentication.AuthenticateAsync(new AuthenticationData("xxxxxxxxxxxxxx")); | |
var tasks = new List<Task<TvDbResponse<BasicEpisode[]>>>(); | |
var firstResponse = await client.Series.GetEpisodesAsync(SeriesId, 1); | |
for (int i = 2; i <= firstResponse.Links.Last; i++) | |
{ | |
tasks.Add(client.Series.GetEpisodesAsync(SeriesId, i)); | |
} | |
var results = await Task.WhenAll(tasks); | |
var episodes = firstResponse.Data.Concat(results.SelectMany(x => x.Data)); | |
Console.WriteLine(episodes.Count()); // 263 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment