Created
October 19, 2015 12:07
-
-
Save jz5/1743957b0c08a58c9be5 to your computer and use it in GitHub Desktop.
This file contains 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
static public async Task<string> GetBathDate(string screenName) | |
{ | |
// ユーザープロフィールページの HTML 取得 | |
string html; | |
using (var client = new WebClient() { Encoding = Encoding.UTF8 }) | |
{ | |
html = await client.DownloadStringTaskAsync("https://twitter.com/" + screenName); | |
} | |
// <span class="ProfileHeaderCard-birthdateText u-dir" dir="ltr"> 直下の <span> のテキスト値取得 | |
var doc = new HtmlAgilityPack.HtmlDocument(); | |
doc.LoadHtml(html); | |
var spans = doc.DocumentNode.SelectNodes(@"//span[@class=""ProfileHeaderCard-birthdateText u-dir""]/span"); | |
return spans?.First().InnerText; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment