7
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 3 years have passed since last update.

Tweepyで 'API' object has no attribute 'search'

Posted at

#エラー内容

今回はこちらの記事を参考にいいね自動化を行ったところ
'API' object has no attribute 'search'

というエラーが出ました。

#解決策

search_results=api.search(q=q,count=count) #countの数だけ検索結果を表示

のapi.searchをapi.search_tweetsに変更します。

search_results=api.search_tweets(q=q,count=count) #countの数だけ検索結果を表示

これで作動しました。
search_tweetsはタブ補完機能で見つけました。

#まとめ
公式のAPIメソッドについてはこちらの記事を参照してください。

searchで見ると

API.search_30_day()
API.search_full_archive()

などが目につきますが、こちらは有料版なので気をつけてください。

7
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
7
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?