现在,代码只提取tweet的内容。
例如: 13703:{'text':'RT @11111: hi hi~~'}
我想提取tweet.Is的日期(2017.04.16)或时间(21:40)可以吗?
import tweepy
import time
import os
import json
import simplejson
search_term = 'word1'
search_term2= 'word2'
search_term3='word3'
lat = "xxxx"
lon = "xxxx"
radius = "xxxx"
location = "%s,%s,%s" % (lat, lon, radius)
API_key = "xxxx"
API_secret = "xxxx"
Access_token = "xxxx"
Access_token_secret = "xxxx"
auth = tweepy.OAuthHandler(API_key, API_secret)
auth.set_access_token(Access_token, Access_token_secret)
api = tweepy.API(auth)
c=tweepy.Cursor(api.search,
q="{}+OR+{}".format(search_term, search_term2, search_term3),
rpp=1000,
geocode=location,
include_entities=True)
data = {}
i = 1
for tweet in c.items():
data['text'] = tweet.text
print(i, ":", data)
i += 1
time.sleep(1)发布于 2017-06-20 11:41:00
我今天在GitHub上提交了一个机器人TwEater。它可以收集所有可能的tweet属性,例如日期、时间、文本、用户名、id、标签、提及、链接,甚至表情符号,以及所有回复的列表等等。你甚至可以在过去7天内收到推文,没有3200条推文限制。去试试吧,玩得开心!
https://stackoverflow.com/questions/43472577
复制相似问题