根据特定的数据抓取twitter数据

2024-06-28 11:23:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚接触twitter Api,所以我不知道它在更广泛的意义上的用途,实际上,我在Ghaza上爬行tweets进行分析,我抓取它,但作为页面的一个示例,这就是我所做的

while(page<=3):
    tweets=api.GetSearch("#Egypt",per_page=100)

现在我想抓取数据,但是从特定的日期开始,比如我想从2010年2月2日到2012年3月7日,只要一个线索就足够了,但任何解释都值得赞赏。在


Tags: 数据api示例pagetwitter页面用途tweets
2条回答

我不想听到坏消息,但当前使用的Twitter API或Python包装器不支持这种搜索。从搜索函数上的documentation

  • The Search API is not complete index of all Tweets, but instead an index of recent Tweets. At the moment that index includes between 6-9 days of Tweets.
  • You cannot use the Search API to find Tweets older than about a week.

我希望这也是可能的,但到目前为止还没有好的解决办法。在

使用[query] since:2014-02-01 until:2014-02-05link to docs

Operator                    Finds tweets…
...
superhero since:2015-07-19  containing “superhero” and sent since date “2015-07-19” (year-month-day).
ftw until:2015-07-19        containing “ftw” and sent before the date “2015-07-19”.
...

相关问题 更多 >