[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
[[ノート/テキストマイニング]]~
訪問者数 &counter(); 最終更新 &lastmod();~
**PythonのTwitter APIの環境整備(インストール) --- 2012/02/28 [#j4ed66fb]
参考
-Python Twitter 〜〜 http://code.google.com/p/python-twitter/
-
Fedora Linuxでは、ここに書いてあるインストール(Building)より簡単な
yumによるインストールが可能である。oreganoではそれを行った。ログは
# yum list | grep python-twitter
python-twitter.noarch 0.8-1.fc13 updates
# yum install python-twitter
読み込んだプラグイン:presto, refresh-packagekit
インストール処理の設定をしています
依存性の解決をしています
--> トランザクションの確認を実行しています
---> パッケージ python-twitter.noarch 0:0.8-1.fc13 をインストールに設定しました
--> 依存性の処理をしています: python-httplib2 のパッケージ: python-twitter-0.8-1.fc13.noarch
--> 依存性の処理をしています: python-oauth2 のパッケージ: python-twitter-0.8-1.fc13.noarch
--> トランザクションの確認を実行しています
---> パッケージ python-httplib2.noarch 0:0.4.0-4.fc12 をインストールに設定しました
---> パッケージ python-oauth2.noarch 0:1.2.1-1.fc13 をインストールに設定しました
--> 依存性解決を終了しました
依存性を解決しました
================================================================================
パッケージ アーキテクチャ
バージョン リポジトリー 容量
================================================================================
インストールしています:
python-twitter noarch 0.8-1.fc13 updates 49 k
依存性関連でのインストールをします:
python-httplib2 noarch 0.4.0-4.fc12 fedora 31 k
python-oauth2 noarch 1.2.1-1.fc13 updates 25 k
トランザクションの要約
================================================================================
Install 3 Package(s)
総ダウンロード容量: 105 k
インストール済み容量: 435 k
これでいいですか? [y/N]y
パッケージをダウンロードしています:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 105 k
(1/3): python-httplib2-0.4.0-4.fc12.noarch.rpm | 31 kB 00:00
(2/3): python-oauth2-1.2.1-1.fc13.noarch.rpm | 25 kB 00:00
(3/3): python-twitter-0.8-1.fc13.noarch.rpm | 49 kB 00:00
--------------------------------------------------------------------------------
合計 30 kB/s | 105 kB 00:03
rpm_check_debug を実行しています
トランザクションのテストを実行しています
トランザクションのテストを成功しました
トランザクションを実行しています
インストールし : python-httplib2-0.4.0-4.fc12.noarch 1/3
インストールし : python-oauth2-1.2.1-1.fc13.noarch 2/3
インストールし : python-twitter-0.8-1.fc13.noarch 3/3
インストールしました:
python-twitter.noarch 0:0.8-1.fc13
依存性関連をインストールしました:
python-httplib2.noarch 0:0.4.0-4.fc12 python-oauth2.noarch 0:1.2.1-1.fc13
完了しました!
**Pythonからtwitter APIを使う例(上記サイトに載っている例)を試してみる [#u60d7a63]
そこそこ動くようだ。
>>> import twitter
/usr/lib/python2.6/site-packages/httplib2/__init__.py:29: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
/usr/lib/python2.6/site-packages/httplib2/__init__.py:44: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
>>> api = twitter.Api()
>>> statuses = api.GetPublicTimeline()
>>> print [s.user.name for s in statuses]
[u'\u79d8\u5bc6\u306e\u3042\u3063\u304d', u'\u30c7\u30a4\u30b7\u30e3', u'fujira', u'Kevin Powell', u'Haley Erickson', u'Tiago Diaz', u'Kitty', u'\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30fb\u30e1\u30c7\u30a3\u30a2\u611b\u77e5\u96fb\u805e', u'Say_Spates', u'\u7947\u4e9e@\u6731\u3063\u9f3b', u'Brittn\u0113', u'Agustina Blasi \u2661', u'Da-na-ja', u'Sinuous Kassie', u'\u0633\u0639\u064a\u062f \u0628\u0646 \u0645\u0638\u0641', u'Kyle Gabrielson ', u'Bano AlKanderi', u'U.V.W.StudioBlue', u'K', u'C.Butler']
>>> print [s.text for s in statuses]
[u'\u300c\u3044\u3064\u672c\u6c17\u3060\u3059\u306e\uff1f\u300d\u3000\u79d8\u5bc6\u306e\u3042\u3063\u304d (中略) , u'Empty frames - neyo']
では、それぞれの要素を書きだしてみよう。まず名前のリストは
>>> for s in st:
... print s.user.name
...
Jus Lala
ayman hamad
たけちゃんbot
Rebecca Saunders
Jenna
THONY GUCCI BRYANT
VaNiaRimUn
Savannah Thomas
heermanz?
Megan Wanatee
suni :D
Frenchie
Brianna Warrior
Im Cheyia & Idqaf ?
Brittany Lemon
*ICanOnlyBeMe*
Savana Tubbs
imo-rx7fc3s
ChasSherrell?
Rafaella Senos
では、テキストは
>>> for s in st:
... print s.text
...
So fuckin foggy outside
????? ?????? ????? ????? ????? ??????? ??? ????? ??? ????? ? ?????? ?????? ????? 28/2/2012: ????? ????? ??? ????... http://t.co/89pXddz4
わりぃ今起きた
The shoes - http://t.co/oJTIvQNi @garancedore they are picnic blankets, sunshine, and juicy oranges all in one! I want
<--- new avi & im off this. goodnight world <3
O_o RT @Deyanilf: El fin de semana que viene nos vamos #lassuperpoderosas con los jevitos pa bonao!!
Bueno y como una buena #dannafan jajaja a dormir como todos escuchando #ruleta lalalalalaaaa por esta ruleta de amor que girara!!! Noches!
i wanna go to sleep but i still have to dry my stupid hair.
Walk the talk.. that's the true LEADER.. http://t.co/uBoNIYOY
I feel like a slice of butter.... melting on a stack of flapjacks.
???. ???? "???? ?? ????" ?? ?? (?????) http://t.co/ZS5oq7hk
Wow that auto correct totally changed wat I was saying
Now I ain't got no kids yet, but this right here's for practice
Keep My Name Up Out Cho Mouf & Be Careful Lil Niqqah - #FreeBoosie
i need a desk...
And For Someone To Say They Love Me Truly, But At The Time It Didn't Mean A Thing.
Is it weird that I'm 16 and still sleep in bed with my mom almost every night?
【48グループ】今までで一番笑ったぐぐたすの投稿 2 http://t.co/BNJkRA64 アダプターの接続部分がつぶれたのなおせるのwwwwwwwww
Who is Andrew calling a #cutiePie !?! About to get out my gun!
quero horario de verao de volta, tchau
次は、漢字のツイートだけを拾って、形態素解析で単語に分解することを考える ⇒ [[ノート/テキストマイニング/Unicode-UTF8文字列の扱い]]
終了行:
[[ノート/テキストマイニング]]~
訪問者数 &counter(); 最終更新 &lastmod();~
**PythonのTwitter APIの環境整備(インストール) --- 2012/02/28 [#j4ed66fb]
参考
-Python Twitter 〜〜 http://code.google.com/p/python-twitter/
-
Fedora Linuxでは、ここに書いてあるインストール(Building)より簡単な
yumによるインストールが可能である。oreganoではそれを行った。ログは
# yum list | grep python-twitter
python-twitter.noarch 0.8-1.fc13 updates
# yum install python-twitter
読み込んだプラグイン:presto, refresh-packagekit
インストール処理の設定をしています
依存性の解決をしています
--> トランザクションの確認を実行しています
---> パッケージ python-twitter.noarch 0:0.8-1.fc13 をインストールに設定しました
--> 依存性の処理をしています: python-httplib2 のパッケージ: python-twitter-0.8-1.fc13.noarch
--> 依存性の処理をしています: python-oauth2 のパッケージ: python-twitter-0.8-1.fc13.noarch
--> トランザクションの確認を実行しています
---> パッケージ python-httplib2.noarch 0:0.4.0-4.fc12 をインストールに設定しました
---> パッケージ python-oauth2.noarch 0:1.2.1-1.fc13 をインストールに設定しました
--> 依存性解決を終了しました
依存性を解決しました
================================================================================
パッケージ アーキテクチャ
バージョン リポジトリー 容量
================================================================================
インストールしています:
python-twitter noarch 0.8-1.fc13 updates 49 k
依存性関連でのインストールをします:
python-httplib2 noarch 0.4.0-4.fc12 fedora 31 k
python-oauth2 noarch 1.2.1-1.fc13 updates 25 k
トランザクションの要約
================================================================================
Install 3 Package(s)
総ダウンロード容量: 105 k
インストール済み容量: 435 k
これでいいですか? [y/N]y
パッケージをダウンロードしています:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 105 k
(1/3): python-httplib2-0.4.0-4.fc12.noarch.rpm | 31 kB 00:00
(2/3): python-oauth2-1.2.1-1.fc13.noarch.rpm | 25 kB 00:00
(3/3): python-twitter-0.8-1.fc13.noarch.rpm | 49 kB 00:00
--------------------------------------------------------------------------------
合計 30 kB/s | 105 kB 00:03
rpm_check_debug を実行しています
トランザクションのテストを実行しています
トランザクションのテストを成功しました
トランザクションを実行しています
インストールし : python-httplib2-0.4.0-4.fc12.noarch 1/3
インストールし : python-oauth2-1.2.1-1.fc13.noarch 2/3
インストールし : python-twitter-0.8-1.fc13.noarch 3/3
インストールしました:
python-twitter.noarch 0:0.8-1.fc13
依存性関連をインストールしました:
python-httplib2.noarch 0:0.4.0-4.fc12 python-oauth2.noarch 0:1.2.1-1.fc13
完了しました!
**Pythonからtwitter APIを使う例(上記サイトに載っている例)を試してみる [#u60d7a63]
そこそこ動くようだ。
>>> import twitter
/usr/lib/python2.6/site-packages/httplib2/__init__.py:29: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
/usr/lib/python2.6/site-packages/httplib2/__init__.py:44: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
>>> api = twitter.Api()
>>> statuses = api.GetPublicTimeline()
>>> print [s.user.name for s in statuses]
[u'\u79d8\u5bc6\u306e\u3042\u3063\u304d', u'\u30c7\u30a4\u30b7\u30e3', u'fujira', u'Kevin Powell', u'Haley Erickson', u'Tiago Diaz', u'Kitty', u'\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30fb\u30e1\u30c7\u30a3\u30a2\u611b\u77e5\u96fb\u805e', u'Say_Spates', u'\u7947\u4e9e@\u6731\u3063\u9f3b', u'Brittn\u0113', u'Agustina Blasi \u2661', u'Da-na-ja', u'Sinuous Kassie', u'\u0633\u0639\u064a\u062f \u0628\u0646 \u0645\u0638\u0641', u'Kyle Gabrielson ', u'Bano AlKanderi', u'U.V.W.StudioBlue', u'K', u'C.Butler']
>>> print [s.text for s in statuses]
[u'\u300c\u3044\u3064\u672c\u6c17\u3060\u3059\u306e\uff1f\u300d\u3000\u79d8\u5bc6\u306e\u3042\u3063\u304d (中略) , u'Empty frames - neyo']
では、それぞれの要素を書きだしてみよう。まず名前のリストは
>>> for s in st:
... print s.user.name
...
Jus Lala
ayman hamad
たけちゃんbot
Rebecca Saunders
Jenna
THONY GUCCI BRYANT
VaNiaRimUn
Savannah Thomas
heermanz?
Megan Wanatee
suni :D
Frenchie
Brianna Warrior
Im Cheyia & Idqaf ?
Brittany Lemon
*ICanOnlyBeMe*
Savana Tubbs
imo-rx7fc3s
ChasSherrell?
Rafaella Senos
では、テキストは
>>> for s in st:
... print s.text
...
So fuckin foggy outside
????? ?????? ????? ????? ????? ??????? ??? ????? ??? ????? ? ?????? ?????? ????? 28/2/2012: ????? ????? ??? ????... http://t.co/89pXddz4
わりぃ今起きた
The shoes - http://t.co/oJTIvQNi @garancedore they are picnic blankets, sunshine, and juicy oranges all in one! I want
<--- new avi & im off this. goodnight world <3
O_o RT @Deyanilf: El fin de semana que viene nos vamos #lassuperpoderosas con los jevitos pa bonao!!
Bueno y como una buena #dannafan jajaja a dormir como todos escuchando #ruleta lalalalalaaaa por esta ruleta de amor que girara!!! Noches!
i wanna go to sleep but i still have to dry my stupid hair.
Walk the talk.. that's the true LEADER.. http://t.co/uBoNIYOY
I feel like a slice of butter.... melting on a stack of flapjacks.
???. ???? "???? ?? ????" ?? ?? (?????) http://t.co/ZS5oq7hk
Wow that auto correct totally changed wat I was saying
Now I ain't got no kids yet, but this right here's for practice
Keep My Name Up Out Cho Mouf & Be Careful Lil Niqqah - #FreeBoosie
i need a desk...
And For Someone To Say They Love Me Truly, But At The Time It Didn't Mean A Thing.
Is it weird that I'm 16 and still sleep in bed with my mom almost every night?
【48グループ】今までで一番笑ったぐぐたすの投稿 2 http://t.co/BNJkRA64 アダプターの接続部分がつぶれたのなおせるのwwwwwwwww
Who is Andrew calling a #cutiePie !?! About to get out my gun!
quero horario de verao de volta, tchau
次は、漢字のツイートだけを拾って、形態素解析で単語に分解することを考える ⇒ [[ノート/テキストマイニング/Unicode-UTF8文字列の扱い]]
ページ名: