我正在编写一个程序,在用户的两个特定日期之间刮推文,同时确保它们不是转发或回复。我使用的是snscrape和tweepy。
for i, tweet in enumerate(sntwitter.TwitterSearchScraper('from:' + lines[x] + ' since:' + startDate + ' until:' + endDate).get_items()):
if tweet.retweetedTweet is None and tweet.inReplyToTweetId is None and tw
我正在尝试获取特定用户的推文收藏列表。他们的twitter账户表明,他们已经收藏了近20000条推文,但通过API返回的收藏列表只有2300条收藏的推文。下面是我的python代码示例:
api = tweepy.API(auth)
test_user = "someuser"
#print out each favorited tweet
for page in tweepy.Cursor(api.favorites,id=test_user,wait_on_rate_limit=True,
count=200).pages(200):
for status i
我正在尝试使用python和tweepy检索一个包含我个人twitter状态的完整内容的列表。
我已经成功地通过OAuth进行了身份验证,但似乎无法从twitter收到超过800条状态更新。我的推特个人主页上说我有超过2000条推文。我完全在Twitter强加给我们的3200条推文限制之内。
任何帮助都将不胜感激!
这是我当前的代码(不包括OAuth应用编程接口身份验证):
for page in tweepy.Cursor(api.user_timeline, count=200).pages(16):
page_list.append(page)
n = n+1
p
因此,我目前试图从Twitter帐户挖掘推文,但我想排除转发,这样我就可以为我的项目获得200条推文数据。目前,我有一个可以工作的代码来挖掘数据馈送,但仍然包含了Re-Tweets。我发现,要排除Re-Tweets,您需要在代码中放入-RT,但我根本不知道放在哪里,因为我对编程非常陌生。
(当前使用Twitter API for Python (Tweepy)和使用Spyder的Python 3.6。)
import tweepy
from tweepy import OAuthHandler
import pandas as pd
consumer_key = 'consumer_
我正在使用Python库。
使用以下代码,我成功地提取了一条tweet的“喜欢”和“重推”计数:
# Get count of handles who are following you
def get_followers_count(handle):
user = api.get_user(handle)
return user.followers_count
# Get count of handles that you are following
def get_friends_count(handle):
user = api.get_user(handle)