2017-04-18 63 views
0

现在,代码仅提取推文的内容。python twitter crawling_how可以提取tweet日期或tweet时间吗?

例如:13703:的

我想提取的日期(2017年4月16日)或时间(21:40){ '文':“喜喜喜喜喜~~ RT @ 11111} tweet.Is有可能吗?

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) 

回答

0

我提交了一个机器人TwEater GitHub上的今天。它可以收集鸣叫的所有可能的属性,例如日期,时间,文本,用户名,编号,主题标签,提及,链接,甚至是表情符号,以及所有回复的列表等等。你甚至可以在过去7天之前收到推文,而不会有3200条推文限制。去试试吧,玩得开心!