首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >python twitter crawling_how我可以提取tweet date或tweet time吗?

python twitter crawling_how我可以提取tweet date或tweet time吗?
EN

Stack Overflow用户
提问于 2017-04-18 20:45:37
回答 1查看 699关注 0票数 0

现在,代码只提取tweet的内容。

例如: 13703:{'text':'RT @11111: hi hi~~'}

我想提取tweet.Is的日期(2017.04.16)或时间(21:40)可以吗?

代码语言:javascript
复制
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)
EN

回答 1

Stack Overflow用户

发布于 2017-06-20 11:41:00

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43472577

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档