Learn R Programming

reproducible (version 3.2.1)

.dlGooglePublic: Download a public Google Drive file without authentication

Description

Internal. Used by dlGoogle() when the user supplies the public web-download form of a Drive URL (or sets reproducible.gdriveNoAuth = TRUE). It fetches the file over plain HTTPS via dlGeneric() -- no googledrive token required.

Usage

.dlGooglePublic(
  url,
  destinationPath,
  targetFile,
  verbose = getOption("reproducible.verbose", 1)
)

Value

A list with destFile.

Arguments

url

The original Google Drive URL (any form).

destinationPath

Directory to download into.

targetFile

The resolved Drive filename (so the on-disk name and checksum bookkeeping match the authenticated path).

verbose

Numeric verbosity level.

Details

Small files stream directly. Large files (>~100 MB, or any that trip Drive's "can't scan for viruses" check) first return an HTML interstitial carrying a one-time confirm token and uuid; these are parsed out and the request is resubmitted to drive.usercontent.google.com/download. If the second attempt still returns HTML, the file is almost certainly not shared "Anyone with the link" and we error rather than silently save the page.