html - 使用 rvest 抓取 html - 获取 http 错误 416

标签 html r scrape rvest

我正在尝试使用 R(package rvest)抓取此页面的 HTML,但收到“客户端错误 416:请求的范围不可满足”

经过长时间的搜索,我似乎无法找到解决方案。它在尝试使用 rvest 的 html 函数时抛出错误,该函数解析 HTML 页面:

url <- "http://shop.tcgplayer.com/magic/onslaught/polluted-delta"
html(url)

我使用的是 R 版本 3.2.0。

如有任何帮助,我们将不胜感激!

最佳答案

你已经很接近了,只需使用现在更新的 read_htmlurl 中提取:

> read_html(url) %>%
+   html_nodes("table") %>%
+   html_text() %>%
+   .[[1]]
[1] "\r\n                                Rarity:\r\n                                                R\r\n                                                Card Type:\r\n                                                Land \r\n                                                Description:\r\n                                                Tap, Pay 1 life, Sacrifice Polluted Delta:  Search your library for an island or swamp card   and put it into play. Then shuffle your library.\r\n\r\n                                \r\n                        "

关于html - 使用 rvest 抓取 html - 获取 http 错误 416,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31092425/

相关文章:

javascript - 试图将数据从 .php 文件传递​​到 .js 文件

php - 不能在同一个页面中编写 HTML 和 PHP 代码

r - 使用 dplyr : Within groups, 选择第一个满足条件的值

node.js - 如何使用 Promise 循环后获取数据

php - 使用PHP从YouTube抓取统计信息

html - 为什么内联 block 元素的边距会影响同级内联 block 元素

r - 如何在 R 中生成自引用变量(例如,给定返回的指数水平)?

r - 扩展数据框使其行数与原始行中两列的范围一样多

python - 使用 BeautifulSoup 抓取 Google 搜索

html - 选择图片或视频