Skip to content

Instantly share code, notes, and snippets.

@jz5
Created October 19, 2015 12:07
Show Gist options
  • Save jz5/1743957b0c08a58c9be5 to your computer and use it in GitHub Desktop.
Save jz5/1743957b0c08a58c9be5 to your computer and use it in GitHub Desktop.
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