Python 2.7 根据关键字、用户名和日期间隔搜索twitter流

Python 2.7 根据关键字、用户名和日期间隔搜索twitter流,python-2.7,twitter,tweetstream,Python 2.7,Twitter,Tweetstream,我想写一个程序,可以从推特推特的关键字,用户名和日期范围的基础上拉。我使用Tweepy编写了一个程序,从流API中提取推文。目前,它基于关键词或用户名发布推文 我想改变程序,包括一个过滤标准:关键字、用户名和日期范围。我应该如何修改程序 使用的Python版本:2.7 from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream # Removed my

我想写一个程序,可以从推特推特的关键字,用户名和日期范围的基础上拉。我使用Tweepy编写了一个程序,从流API中提取推文。目前,它基于关键词或用户名发布推文

我想改变程序,包括一个过滤标准:关键字、用户名和日期范围。我应该如何修改程序

使用的Python版本:2.7

from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream

# Removed my authentication parameters because of confidentiality
consumer_key=
consumer_secret=
access_token=
access_token_secret=

class StdOutListener(StreamListener):
    def on_data(self, data):
        saveFile= open('save_tweets.txt','a')
        saveFile.write(data)
        saveFile.write('\n')
        return True

    def on_error(self, status):
        print(status)

    def on_limit(self, track):
        return

    def on_timeout(self):
        print ('time out')
        return

    def on_disconnect(self, notice):
        print (notice)
        return    
l = StdOutListener()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
stream = Stream(auth, l)
track_list=['art','gallery']
follow_list=['70100659','12804422']
stream.filter(track=track_list, follow=follow_list)

你找到解决这个问题的方法了吗?我让它在Twitter搜索API中的自始至终操作程序中工作。然而,也有一些例子,当我收到的推特超出了日期范围或在日期范围内。最好的方法是按所需的日期范围多次从Twitter搜索API中提取推文,然后根据发布日期保留相关推文。