archive.org Wayback Machine API 在一个请求中提供多个 URL [英] archive.org Wayback Machine API multiple URLs at one Request

查看:66
本文介绍了archive.org Wayback Machine API 在一个请求中提供多个 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人知道如何在一个请求中将多个 url 传递给

或在 R 中传递:

r$archived_snapshots.closest.url[1] http://web.archive.org/web/20180511050915/https://www.onet.pl/[2] http://web.archive.org/web/20180510143400/https://www.wired.com/[3] http://web.archive.org/web/20180511013018/http://@geocities.com/3 个级别:http://web.archive.org/web/20180511050915/https://www.onet.pl/...

想要更多数据?尝试使用 Wayback CDX 服务器 API

Is somebody aware of how to pass multiple urls in one request to the Wayback Machine API ? Or is it even possible to do that?

I looked for it all over the internet but I didn't find anything about how to do it.

解决方案

one url, one request, one answer - but a list of urls can be checked within the loop; for ex. in R:

urls <- c("http://onet.pl","http://wired.com","http://geocities.com")

ask_wm_api <- function(urls) {
  library(jsonlite)
  df <- data.frame()
  for(u in urls) {
    x <- fromJSON(paste0("http://archive.org/wayback/available?url=",u))
    df <- rbind(df, as.data.frame(x))
  }
  return(df)
}

r <- ask_wm_api(urls)

in effect: a data frame which can be easily export to csv:

or passed in R:

r$archived_snapshots.closest.url
[1] http://web.archive.org/web/20180511050915/https://www.onet.pl/  
[2] http://web.archive.org/web/20180510143400/https://www.wired.com/
[3] http://web.archive.org/web/20180511013018/http://@geocities.com/
3 Levels: http://web.archive.org/web/20180511050915/https://www.onet.pl/ ...

Want more data? Try to use Wayback CDX Server API

这篇关于archive.org Wayback Machine API 在一个请求中提供多个 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆