twitter のパブリックタイムラインページを 5 秒おきに取得する C# プログラム
使い捨てで書いたものだけど、我ながらかなりキモかったので晒してみる。
using System; using System.Net; using System.IO; using System.Windows.Forms; class ptl : Form { Timer timer; public ptl() { timer = new Timer() { Interval = 5000 }; timer.Tick += (sender, e) => File.WriteAllText("stack" + DateTime.Now.Ticks + ".log", (new WebClient() { Proxy = new WebProxy("proxy.example.jp", 8080) { Credentials = new NetworkCredential("hoge", "fuga") } }).DownloadString("http://twitter.com/public_timeline")); timer.Start(); } [STAThread] static void Main() { Application.Run(new ptl()); } }
……一行化の限界に挑戦してみました。 :p
ちなみに、認証付きのプロキシを通さないといけない環境から接続していたので、やたら横に長いです。
それにしても、 C# 3.0 ってすばらしい>< ←可読性を損なうからやめなさい