瀏覽代碼

beautify fetching

package
flavis 4 年之前
父節點
當前提交
aac8280843
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. +6
    -3
      scraping/fetch.R

+ 6
- 3
scraping/fetch.R 查看文件

@@ -16,9 +16,12 @@ download_protocol <- function(path, name) {
}

fetch_batch <- function(offset) {
url <- mk_url(offset)
res <- as.character(read_html(url))
paths <- str_match_all(res, "/resource/blob/.*?/([0-9]*-data\\.xml)")[[1]]
mk_url(offset) %>%
read_html() %>%
as.character() %>%
str_match_all("/resource/blob/.*?/([0-9]*-data\\.xml)") %>%
`[[`(1) ->
paths
mapply(download_protocol, paths[,1], paths[,2])
return(length(paths) > 0)
}


Loading…
取消
儲存