R twitteR searchTwitter 地理编码警告/错误

编程入门 行业动态 更新时间:2024-10-25 23:22:32
本文介绍了R twitteR searchTwitter 地理编码警告/错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在尝试使用 twitteR 包提取推文,但是当我按照他们在文档中的方式指定地理编码时,我在通过 searchTwitter 功能获取它们时遇到了问题.请看下面的代码:

I'm trying to pull tweets using the twitteR package, but I'm having an issue getting them through the searchTwitter function when I specify a geocode the way they have it in their docs. Please see code below:

    #Oauth code (successful authentication)

    keyword = "the"
    statuses = searchTwitter(keyword, n=100, lang="en",sinceID = NULL, geocode="39.312957, -76.618119, 10km",retryOnRateLimit=10)

当我省略 geocode="39.312957, -76.618119, 10km", 时,代码可以完美运行,但是当我包含它时,我得到以下内容:

Code works perfectly when I leave out geocode="39.312957, -76.618119, 10km",, but when I include it, I get the following:

    Warning message:
    In doRppAPICall("search/tweets", n, params = params, retryOnRateLimit = retryOnRateLimit,  :
    100 tweets were requested but the API can only return 0

我以为我的格式可能有误,但根据 twitteR CRAN 页面,该字符串的格式正确(我也尝试在 km 和 mi 之间切换).

I thought maybe my formatting was wrong but based on the twitteR CRAN page the string is in the right format (I also tried switching between km and mi).

有没有其他人经历过这种情况或知道搜索特定地理编码的更好方法?他们会否弃用地理编码功能?

Has anyone else experienced this or know a better way to search for a specific geocode? Would they have deprecated the geocode functionality?

我正在寻找来自巴尔的摩的推文,所以如果有更好的方法,我会全力以赴.(顺便说一句,我想避免尝试拉取所有推文然后过滤自己,因为我认为我会很快达到数据限制并错过我正在寻找的内容)

I'm looking for tweets from Baltimore so if there is a better way to do so, I'm all ears. (By the way, I want to avoid trying to pull all tweets and then filter myself because I think I will hit the data limit fairly quickly and miss out on what I'm looking for)

谢谢!

推荐答案

我认为您需要删除 geocode 参数中的空格:

I believe you need to remove the spaces in the geocode parameter:

statuses = searchTwitter(keyword, n=100, lang="en",sinceID = NULL, geocode="39.312957,-76.618119,10km",retryOnRateLimit=10)

FWIW 在将 URL 提交到脚本之前,您可以使用 Twitter 桌面客户端开发"控制台来测试 URL.

FWIW You can use the Twitter desktop client "Develop" console to test out URLs before committing them into scripts.

这篇关于R twitteR searchTwitter 地理编码警告/错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 16:13:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1192073.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地理   错误   twitteR   searchTwitter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!