Webscraping“您如何为OpenStreetMap贡献”带rvest

发布于 2025-01-24 20:12:59 字数 1054 浏览 1 评论 0 原文

我想从“您如何为OpenStreetMap贡献?”中刮除所有信息? ( https://hdyc.neis-one.org/ )。为了获得用户配置文件,有必要登录到OSM。

由于需要刮擦很多配置文件,因此我想使用rvest软件包自动刮擦列表()。

到目前为止,我尝试这样做:

> library(rvest)

> url <- "https://hdyc.neis-one.org/?mrsensible"
> pgsession <- session(URL)

> pgsession
<session> https://hdyc.neis-one.org/?mrsensible
  Status: 200
  Type:   text/html
  Size:   4245

当我尝试使用 read_html(url)读取OSM记录的信息时,这就是事实:

> read_html(url)

{html_document}
<html>
[1] <head>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n<meta ...
[2] <body onload="init();">\n        <div class="copyright">Copyright © <a target="_bl ...

因此,它并没有真正捕获信息。

可以使用 rvest 代码刮擦数据吗? 非常感谢!

I would like to scrape all the information from the "How did you contribute to OpenStreetMap?" (https://hdyc.neis-one.org/). It is necessary to login to OSM in order to gain a user profile.

Since there are quite a lot of profiles that need to be scraped, I want to automatically scrape the list using the rvest package (https://rvest.tidyverse.org/).

So far I attempted to do this:

> library(rvest)

> url <- "https://hdyc.neis-one.org/?mrsensible"
> pgsession <- session(URL)

> pgsession
<session> https://hdyc.neis-one.org/?mrsensible
  Status: 200
  Type:   text/html
  Size:   4245

When I tried to read the information of my OSM record with read_html(url), here is what it turns out:

> read_html(url)

{html_document}
<html>
[1] <head>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n<meta ...
[2] <body onload="init();">\n        <div class="copyright">Copyright © <a target="_bl ...

So it doesn't really capture the information.

Would it be possible to scrape the data using rvest codes?
Many thanks in advance!

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

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

发布评论

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