【问题标题】:Image src Scraping from Facebook Post using rvest使用 rvest 从 Facebook Post 抓取图像 src
【发布时间】:2016-01-08 07:52:59
【问题描述】:

我正在使用 rvest 包来抓取 Facebook 帖子并提取 img src url。

library(rvest)
UrlPage <- read_html ("https://www.facebook.com/AmazonIN/photos/a.142199085973905.1073741828.100281786832302/458742987652845/?type=3")
UrlPage %>% html_node("#fbPhotoImage")

错误:没有匹配项

rvest 包适用于其他网站,但似乎对 Facebook 有一些问题。

还有其他方法可以在 R 中抓取帖子照片吗?

【问题讨论】:

  • 你试过Rfacebook包和Facebook Api吗?
  • 抓取违反 Facebook 的 ToS。如果您想从 Facebook 获取任何数据 - 使用他们的 API
  • @Marta Rfacebook 不提供帖子或帖子照片的缩略图。
  • @CBroe 尝试抓取,因为我无法获取帖子的照片或从 Open Graph 生成的缩略图。

标签: r facebook facebook-graph-api rvest


【解决方案1】:

首先使用R中的以下代码将html页面下载到本地系统

download.file(url, destfile.html , quiet = FALSE, mode = "w",
          cacheOK = TRUE,
          extra = getOption("download.file.extra"))

然后给出读取html页面的本地路径,并抓取图片。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-04-05
  • 2018-04-19
  • 2012-08-28
  • 2016-11-30
  • 1970-01-01
  • 2010-11-12
  • 1970-01-01
相关资源
最近更新 更多