0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Twythonを使って色々やってみる

Last updated at Posted at 2019-02-26

twythonをインストール

$ pip install twython

OAuth 2設定

twythonをimportし、TwitterのAPI情報を設定

from twython import Twython

APP_KEY = 'YOUR_APP_KEY'
APP_SECRET = 'YOUR_APP_SECRET'

twitter = Twython(APP_KEY, APP_SECRET, oauth_version=2)
ACCESS_TOKEN = twitter.obtain_access_token()

twitter = Twython(APP_KEY, access_token=ACCESS_TOKEN)

Tweetをキーワードで抽出

twitter.search(q='xxx')

#人気順で表示する場合は↓等、色々カスタマイズできます(リファレンスtwitter developer参照)
#twitter.search(q='xxx', result_type='popular')

リファレンス

twython
twitter developer

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?