Skip to content

Instantly share code, notes, and snippets.

@jz5
Created Oct 19, 2015
Embed
What would you like to do?
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