Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

updated at

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

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
2
Help us understand the problem. What are the problem?