Created
December 17, 2012 13:45
-
-
Save SeriousM/4318378 to your computer and use it in GitHub Desktop.
Get YouTube Daily Top Tracks Playlists
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
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