Created
June 9, 2012 07:56
-
-
Save shimizukawa/2900045 to your computer and use it in GitHub Desktop.
Twitterのつぶやきをランダムに表示するだけの能力
This file contains hidden or 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
>>> import json | |
>>> import urllib | |
>>> import random | |
>>> def meigen(name): | |
... url = urllib.urlopen('http://twitter.com/statuses/user_timeline/%s.json' % name) | |
... return random.choice(json.loads(url.read()))['text'] | |
... | |
>>> print meigen('atsuoishimoto') | |
「妻に支えられてるふりをする技術」 |
This file contains hidden or 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
>>> import json | |
>>> import urllib | |
>>> import random | |
>>> url = urllib.urlopen('http://twitter.com/statuses/user_timeline/xaxtsuxo.json') | |
>>> data = url.read() | |
>>> tweets = json.loads(data) | |
>>> tweet = random.choice(tweets) | |
>>> print tweet['text'] | |
「俺はいまだにOperaの社長が「アメリカまで泳ぐ」と宣言したのに泳がなかったことを | |
許してはいない。」ぁっぉ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment