Description Usage Arguments Details Value References Examples
View source: R/core_articles_pdf.R
Download article pdf
1 2 3 | core_articles_pdf(id, key = NULL, overwrite = FALSE, ...)
core_articles_pdf_(id, key = NULL, overwrite = FALSE, ...)
|
id |
(integer) CORE ID of the article that needs to be fetched. One or more. Required |
key |
A CORE API key. Get one at
https://core.ac.uk/api-keys/register. Once you have the key,
you can pass it into this parameter, or as a much better option,
store your key as an environment variable with the name
|
overwrite |
(logical) overwrite file or not if already
on disk. Default: |
... |
Curl options passed to |
core_articles_pdf
does the HTTP request and parses
PDF to text, while core_articles_pdf_
just does the HTTP request
and gives back the path to the file
If you get a message like Error: Not Found (HTTP 404)
, that means
a PDF was not found. That is, it does not exist. That is, there is no
PDF associated with the article ID you searched for. This is the
correct behavior, and nothing is wrong with this function or this
package. We could do another web request to check if the id you
pass in has a PDF or not first, but that's another request, slowing
this function down.
core_articles_pdf_
returns a file path on success.
When many IDs passed to core_articles_pdf
it returns a list (equal to
length of IDs) where each element is a character vector of length equal
to number of pages in the PDF; but on failure throws warning and returns
NULL. When single ID apssed to core_articles_pdf
it returns a character
vector of length equal to number of pages in the PDF, but on failure
stops with message
https://core.ac.uk/docs/#!/articles/getArticlePdfByCoreId
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
# just http request, get file path back
core_articles_pdf_(11549557)
# get paper and parse to text
core_articles_pdf(11549557)
ids <- c(11549557, 385071)
res <- core_articles_pdf(ids)
cat(res[[1]][1])
cat(res[[2]][1])
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.