Skip to content

Instantly share code, notes, and snippets.

@SeriousM
Created December 17, 2012 13:45
Show Gist options
  • Save SeriousM/4318378 to your computer and use it in GitHub Desktop.
Save SeriousM/4318378 to your computer and use it in GitHub Desktop.
Get YouTube Daily Top Tracks Playlists
List<Task> tasks = new List<Task>();
for (int i = 1; i <= 1000; i++) {
var reqT = new HttpClient().GetAsync("http://www.youtube.com/playlist?list=MCUS.." + i);
reqT.ContinueWith(t => {
var req = t.Result;
if (req.IsSuccessStatusCode) {
var title = Regex.Match(req.Content.ReadAsStringAsync().Result, "(<title>).*(</title>)").ToString().Replace("<title>", string.Empty).Replace("</title>", string.Empty);
Console.WriteLine((req.RequestMessage.RequestUri + " - " + title));
}
});
tasks.Add(reqT);
}
Console.WriteLine("http://www.youtube.com/playlist?list=MCUS - YouTube Daily Top Tracks - YouTube");
tasks.ForEach(x => x.Start());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment