twitteR r 包:如何在 API 限制内为每个帐户获取尽可能多的推文 [英] twitteR r package: How to get as many tweets as possible per account within API limits

查看:18
本文介绍了twitteR r 包:如何在 API 限制内为每个帐户获取尽可能多的推文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 R 和 twitteR 软件包的新手,但我找不到有关如何完成以下内容的强烈建议.

I'm a novice R and twitteR package user but I wasn't able to find a strong recommendation on how to accomplish the following.

我想挖掘少量 Twitter 帐户,以确定它们的关键字使用输出.(即我还不知道关键字是什么)

I'd like to mine a small number of twitter accounts to identify their output for keyword usage. (i.e. I don't know what the keywords are yet)

假设:

  1. 我有少量推特帐户 (<6) 如果您汇总各种帐户状态,我想最多挖掘 7000 条推文
  2. 这些帐户并没有以很快的速度生成新的推文(一些天)
  3. 根据lookupUsers()
  4. 返回的个人资料数据,这些账户的推文都少于3200条
  1. I have a small number of tweeter accounts (<6) I want to mine with a max of 7000 tweets if you aggregate the various account statuses
  2. Those accounts are not generating new tweets at a fast rate (a few a day)
  3. The accounts all have less than 3200 tweets according to the profile data returned by lookupUsers()

当我使用 twitteR 函数时 userTimeline("accountname", n=3200) 我得到了 40 到 600 个返回的观察值,即没有接近 3200.我知道有 API 限制,但如果它是一个限制问题,我希望得到相同数量的观察结果或收到通知我需要等待 15 分钟

When I use the twitteR function userTimeline("accountname", n=3200) I get between 40 and 600 observations returned i.e no where near the 3200. I know there are API limits but if it was an issue of limits I would expect to get the same number of observations back or get the notice that I need to wait 15 mins

如何在玩得开心的同时获得我需要的所有文本?

How do I get all the text I need while still playing nice ?

推荐答案

通过使用 cran 和 github 包的组合,可以获得用户的所有推文

By using a combination of cran and github packages it was possible to get all the tweets for a user

使用的包是 cran 中的 streamR 和 https://github.com/SMAPPNYU/smappR/ 帮助分析和获取推文.

The packages used were streamR available in cran and https://github.com/SMAPPNYU/smappR/ to help with the analysis and getting the tweets.

基本步骤是

  1. 使用 oauth 和您的 twitter 密钥、令牌和机密对 twitter 进行身份验证
  2. 使用 smappR 函数 getTimeline() 将推文保存到您指定的 json 文件中
  3. 使用 parseTweets(jsonfile) 将 json 内容读入数据帧

这篇关于twitteR r 包:如何在 API 限制内为每个帐户获取尽可能多的推文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆