1

ダウンロード用に共有されたドロップボックス リンクがありますが、他のリンクとは異なり、ダウンロードは禁止されています。

私の機能:

source_DropboxData <- function(file, key, sha1 = NULL, sep = ",", header = TRUE){
  URL <- paste0('https://dl.dropboxusercontent.com/s/', 
            key, '/', file)

  stopifnot(is.character(URL), length(URL) == 1)

  temp_file <- tempfile()
  on.exit(unlink(temp_file))

  request <- GET(URL)
  stop_for_status(request)
  writeBin(content(request, type = "raw"), temp_file)

  file_sha1 <- digest(file = temp_file, algo = "sha1")

  if (is.null(sha1)) {
    message("SHA-1 hash of file is ", file_sha1)
  }
  else {
    if (!identical(file_sha1, sha1)) {
      stop("SHA-1 hash of downloaded file (", file_sha1, 
       ")\n  does not match expected value (", sha1, 
           ")", call. = FALSE)
    }
  }

  read.table(temp_file, sep = sep, header = header)
}    

私のリンクは次のようになります。

https://www.dropbox.com/sh/od6ymc4wu8uht5e/IxPX-EOhNx/a%b%x  #fake, for demonstration

正式なものは次のようになります。

http://dl.dropbox.com/s/c18lcwnnrodsevt/test_dropbox_source.R

私の質問は、2 つのリンクの違いは何ですか。1 つは安全でダウンロードできませんが、もう 1 つは可能ですか? repmis の機能は、プライベート ファイルとパブリック ファイルの両方を処理できるという印象を受けました。

ありがとう

4

1 に答える 1