Python Twitter REST API v1.1-按日期搜索?
有没有一种方法可以使用Twitter的API 1.1在某一天或上周搜索所有带有特定查询的帖子Python Twitter REST API v1.1-按日期搜索?,python,twitter,python-module,Python,Twitter,Python Module,有没有一种方法可以使用Twitter的API 1.1在某一天或上周搜索所有带有特定查询的帖子 是否有任何符合API的python模块能够做到这一点(我一直在使用twython),或者是否有任何特定的模块可以推荐用于此任务?简短回答,是 例如: #Import the required modules from twython import Twython import json import csv #Set the path for the output file path = r'C:\U
是否有任何符合API的python模块能够做到这一点(我一直在使用twython),或者是否有任何特定的模块可以推荐用于此任务?简短回答,是 例如:
#Import the required modules
from twython import Twython
import json
import csv
#Set the path for the output file
path = r'C:\Users\etc\file.txt'
#Setting the OAuth
Consumer_Key = 'XXX';
Consumer_Secret = 'XXX';
Access_Token = 'XXX';
Access_Token_Secret = 'XXX';
#Connection established with Twitter API v1.1
twitter = Twython(Consumer_Key, Consumer_Secret, Access_Token, Access_Token_Secret);
#Twitter is queried
response = twitter.search(q='%40annoys_parrot', since = '2014-02-04', until = '2014-02-05');
#Results are printed
print(json.dumps(response, sort_keys = True, indent = 2))
#Results are saved to txt file
file = open(path, 'w')
file.write((json.dumps(response, sort_keys = True, indent = 2)))
file.close()
然后,您只需要解析结果。你可以找到更多关于这方面的信息