如何获取从日期 x 到日期 y 的推文
How to get Tweet from date x to date y
def search_for_a_tweet(bearer_token, query,D1,D2):
url = "https://api.twitter.com/1.1/statuses/user_timeline.json"
formed_url ='?screen_name='+query+'&count=300&fromDate=D1&toDate=D2'
search_results = search_for_a_tweet(bearer_token,'TOIIndiaNews','201808060000','201808070000')
这里我只得到当前日期的推文。
帮助我。
您应该改用搜索 API :https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html
要在一段时间内获取特定用户的推文,q
参数将是例如:
q=from:user since:2018-08-15 until:2018-08-18
(在发送之前对查询进行 urlencode)。
但是对于 public API,您将只能获得最后 7 天。
因此,您可以在官方 Twitter 网站上执行查询:
def search_for_a_tweet(bearer_token, query,D1,D2):
url = "https://api.twitter.com/1.1/statuses/user_timeline.json"
formed_url ='?screen_name='+query+'&count=300&fromDate=D1&toDate=D2'
search_results = search_for_a_tweet(bearer_token,'TOIIndiaNews','201808060000','201808070000')
这里我只得到当前日期的推文。 帮助我。
您应该改用搜索 API :https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html
要在一段时间内获取特定用户的推文,q
参数将是例如:
q=from:user since:2018-08-15 until:2018-08-18
(在发送之前对查询进行 urlencode)。
但是对于 public API,您将只能获得最后 7 天。 因此,您可以在官方 Twitter 网站上执行查询: