Skip to content

Instantly share code, notes, and snippets.

Commands = new Dictionary<string, Command>() { { "はい", null }, { "いいえ", null }, { "教えて", null } };
_rec = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("ja-JP"));
@jz5
jz5 / feed.xml
Created November 23, 2015 12:37
<rss version="2.0" xmlns:p="http://pinga.mu/terms/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dcndl="http://ndl.go.jp/dcndl/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>すぱこー</title>
<link>http://pronama.azurewebsites.net/tag/spaco/</link>
<description>高校生の暮井 慧(プロ生ちゃん)と、部活「情報処理研究会」のメンバー 戸増千由莉とフィネス・ヒルヴィレッジが活躍する Web 4コマ漫画「すぱこー」!</description>
<pubDate>Sun, 15 Nov 2015 12:30:39 GMT</pubDate>
<image>http://pronama.azurewebsites.net/wp-content/uploads/2015/05/spaco_banner.png</image>
<dc:creator>池村ヒロイチ</dc:creator>
<item>
app.UseTwitterAuthentication(
New TwitterAuthenticationOptions With {
.ConsumerKey = "xxx",
.ConsumerSecret = "xxx",
.Provider = New TwitterAuthenticationProvider With {
.OnAuthenticated = Async Function(context)
context.Identity.AddClaim(New Claim("urn:tokens:twitter:accesstoken", context.AccessToken))
context.Identity.AddClaim(New Claim("urn:tokens:twitter:accesstokensecret", context.AccessTokenSecret))
End Function
},
static void Main(string[] args)
{
var birthDate = GetBathDate("5zj").Result?.Trim();
Console.WriteLine(birthDate);
// birthDate の例:
// "誕生日 1990年7月7日"
// "誕生日 July 07"
// "誕生日 1990"
// 英語の場合:
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> のテキスト値取得
<div class="ProfileHeaderCard-birthdate ">
<span class="Icon Icon--balloon Icon--medium"></span>
<span class="ProfileHeaderCard-birthdateText u-dir" dir="ltr"><span class="js-tooltip" title="公開"> 誕生日 January 11
</span>
</span>
@jz5
jz5 / Module1.vb
Last active October 14, 2015 03:58
Imports CoreTweet
Module Module1
Sub Main()
Dim consumerKey = "***"
Dim consumerSecret = "***"
Dim accessToken = "***"
Dim accessSecret = "***"
@jz5
jz5 / sample.cs
Last active September 30, 2015 16:18
public class SharedCountReulst
{
public string Url { get; set; }
public long MaxId { get; set; }
public int Count { get; set; }
}
public static SharedCountReulst Count(string url, long sinceId)
{
var tokens = CoreTweet.Tokens.Create(consumerKey, consumerSecret, accessToken, accessTokenSecret);
Public Class FooTraceListener
Inherits TraceListener
Public Overrides Sub Write(message As String)
' どこかに出力する
End Sub
Public Overrides Sub WriteLine(message As String)
' どこかに出力する
End Sub