抓取TripAdvisor搜索查询结果

发布于 2025-01-29 15:13:34 字数 538 浏览 3 评论 0原文

我正在尝试刮擦特定搜索词的次数(在这种情况下,在不同的景点/位置的TripAdvisor评论中都引用了http 403错误。

是否有修复程序,此TripAdvisor不想让我刮擦此页面吗?

install.packages("rvest")
library(rvest)
install.packages("xml2")
library(xml2)

place <- xml2::read_html("https://www.tripadvisor.com/Search?q=sunset&geo=186216") %>%
html_nodes(".result-title") %>%
html_text()
place

sunsets <- xml2::read_html("https://www.tripadvisor.com/Search?q=sunset&geo=186216") %>%
html_nodes(".review-mention-block") %>%
html_text()
sunsets

谢谢!

I'm trying to scrape the number of times a particular search term (in this case "sunset") is referenced in TripAdvisor reviews at different sights/locations, but I'm getting a http 403 error.

Is there a fix, of is this TripAdvisor not wanting me to scrape this page?

install.packages("rvest")
library(rvest)
install.packages("xml2")
library(xml2)

place <- xml2::read_html("https://www.tripadvisor.com/Search?q=sunset&geo=186216") %>%
html_nodes(".result-title") %>%
html_text()
place

sunsets <- xml2::read_html("https://www.tripadvisor.com/Search?q=sunset&geo=186216") %>%
html_nodes(".review-mention-block") %>%
html_text()
sunsets

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文