尽管挖掘了趋势关键词,但似乎无法提取超过 88 条推文

Cannot seem to extract more than 88 tweets despite mining for trending keywords

我正在尝试使用我的时间轴上当前流行的关键字搜索大约 20,000 条推文。

但是,我只收到大约 88 条推文。这些是全国的热门关键词,只有 88 条推文可用的可能性很小。

这是我的代码

library(rtweet)
sona_tweets <- search_tweets(
    q = "SONA19 OR SONA2019 OR SONA", 
    n = 25000, 
    type = "popular",
    include_rts = FALSE,
    retryonratelimit = TRUE
)

使用 rtweet::search_tweets() 时,您应该注意一些限制和 type 参数。

首先,search_tweets() 只有过去 6-9 天的 returns 数据。另外,要return一次调用超过18000个状态,必须设置retryonlimit = TRUE

根据文档,type 参数定义为:

Character string specifying which type of search results to return from Twitter's REST API. The current default is type = "recent", other valid types include type = "mixed" and type = "popular".

因此,要获得过去 6-9 天的 "everything",您需要使用 type = "mixed"。这意味着您应该将代码更改为:

library(rtweet)
sona_tweets <- search_tweets(
    q = "SONA19 OR SONA2019 OR SONA", 
    n = 25000, 
    type = "mixed",
    include_rts = FALSE,
    retryonratelimit = TRUE
)

你应该return你的预期结果。