[英]python twitter crawling_how can I extract tweet date or tweet time?
Now the code extracts only the content of the tweet. 现在,代码仅提取推文的内容。
ex: 13703 : {'text': 'RT @11111: hi hi hi hi hi~~'} 例如:13703:{'text':'RT @ 11111:嗨嗨嗨嗨~~'}
I want to extract the date(2017.04.16) or time(21:40) of tweet.Is it possible? 我想提取tweet的日期(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)
I submitted a bot TwEater today on GitHub. 我今天在GitHub上提交了一个机器人TwEater 。 It can collect all possible attributes of tweets, such as date, time, text, username, id, hashtags, mentions, links, even emojis, and the list of all its replies and so on. 它可以收集所有可能的推文属性,例如日期,时间,文本,用户名,ID,主题标签,提及,链接,甚至表情符号,以及所有回复的列表等。 You can even get tweets earlier than past 7 days, no 3200 tweets limit. 您甚至可以比过去7天更早获得推文,没有3200条推文限制。 Go try it and have fun! 去尝试一下,玩得开心!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.