我正在查看 tweepy 和 twitterAPI 来过滤过去的 twitter 数据。为了过滤过去的数据,您需要 full_archive_search 或 30_days 搜索方法。不幸的是,与标准搜索不同,没有一种方法可以只流式传输英文推文(即标准搜索有一个名为 lang 的选项,可以将其设置为“en”以仅流式传输英文推文。)我只是想知道是否有类似的高级搜索或任何其他方法的功能?
顺便说一句,我使用沙盒版本使用高级搜索(免费但有限的流媒体选项)
这些是我的 tweepy 和 twitterAPI 流媒体方法
def stream_past_tweets(self,keyword,search_from,search_to):
""" Method to search for past tweets using Tweepy """
# Stream past twitter data (since 2006)
pastTweetsObj = self.api.search_full_archive(
environment_name = 'VolcanicDisaster',
query = keyword,
fromDate = search_from,
toDate = search_to
)
def stream_past_tweets(self,keyword,search_from,search_to,num_tweets):
""" Method to stream past tweets using TwitterAPI"""
# Make request to twitter API
self.req = self.api.request(
'tweets/search/%s/:%s' % ('fullarchive','VolcanicDisaster'),
#'tweets/search/fullarchive/:VolcanicDisaster',
{
'query': keyword,
'fromDate' : search_from,
'toDate' : search_to,
'maxResults' : num_tweets,
}
)
关于可以包含哪些参数以流式传输英文推文的任何想法?