2017-04-18 84 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條推文限制。去試試吧,玩得開心!