2024-04-23 07:35:44 发布
网友
我抓取了一个shtml链接列表。它们现在保存在.xlsx文件中。你知道吗
List
我已经试过寻找excel宏、r代码、python代码、chrome扩展和桌面程序。我找不到任何对我有帮助的研究。你知道吗
每个.shtml链接都指向一个网页,其中至少有一个.pdf位于我需要下载的页面的中心。你知道吗
感谢您的帮助!你知道吗
这很有帮助!你知道吗
install.packages("rvest") install.packages("httr") install.packages("readxl") update.packages("tibble") library(rvest) library(httr) library(readxl) setwd("C:/Users/Andreas/Desktop/481064 A.F. - Master Thesis - Election Outcome Prediction/Full Repository Austrian Bundestag") my_data <- read_excel("StenographischeProto.xlsx") View(my_data) session <- html_session("https://www.uscis.gov/sites/default/files/files/form/i-765.pdf") # save pdf to test.pdf writeBin(session$response$content,"test.pdf")
基本工作流程是:
css
xpath
Rselenium to simulate the download action
href
rvest
writeBin()
要下载pdf文件,我将以政府表格为例:
pdf网址:https://www.uscis.gov/sites/default/files/files/form/i-765.pdf
library(rvest) library(httr) session <- html_session("https://www.uscis.gov/sites/default/files/files/form/i-765.pdf") # save pdf to test.pdf writeBin(session$response$content,"test.pdf")
这很有帮助!你知道吗
基本工作流程是:
css
或xpath
找到pdf下载按钮。你知道吗Rselenium to simulate the download action
;或者获取href
属性并使用rvest
向该链接发出请求,然后使用writeBin()
将二进制响应写入磁盘要下载pdf文件,我将以政府表格为例:
pdf网址:https://www.uscis.gov/sites/default/files/files/form/i-765.pdf
相关问题 更多 >
编程相关推荐