Skip to content

mosaic get ​

Downloads the PDF of one paper by DOI, or of every DOI in a BibTeX or CSV file. Papers that fail can be retried in a browser: one mosaic drives (--interactive) or your own (--handoff).

Usage ​

bash
mosaic get 10.3389/fphy.2019.00140                    # one paper
mosaic get --from refs.bib                            # every DOI in a BibTeX file
mosaic get --from refs.csv --oa-only                  # papers with no open copy count as skipped
mosaic get 10.1016/j.paerosci.2006.01.001 --handoff   # download it yourself; mosaic files it
mosaic get --from refs.bib --interactive              # retry failures in a visible browser
mosaic get 10.3389/fphy.2019.00140 --download-dir ~/papers/project

Behaviour ​

Where the PDF comes from, in order: a PDF already recorded for the paper in the cache; the paper's known PDF link; up to six open-access locations Unpaywall knows (needs mosaic config --unpaywall-email); a saved browser session (mosaic auth). Every file is checked to start with the PDF signature: an HTML page is never saved as a PDF. See downloads.

Metadata. Title, authors and year come from the cache, or from Crossref, so the file gets the same name a search would give it (filename_pattern, default {year}_{source}_{author}_{title}).

--from reads every doi = {...} field of a .bib file, or the doi column (any case) of a .csv file. Duplicates are downloaded once. One line per DOI, then a summary: downloaded, failed, skipped.

--interactive opens the failed papers in a browser window mosaic controls, with your saved sessions, where you log in or pass a check; it needs the browser extra. --handoff opens them one at a time in your default browser and watches the downloads folder (--watch-dir, or the detected one): the next PDF that appears is moved into the library under the paper's name. Press Enter when done with a paper, or to skip it. Hand-off works where publishers refuse any automated browser, as Elsevier does.

Exit code 1 if you give both a DOI and --from, neither, or a file that does not exist or has the wrong type; if the DOI has no downloadable copy; or, with --from, if any paper failed. Papers counted as skipped with --oa-only do not make it fail.

See also: tutorial 4, tutorial 5, downloading recipes, paywalls recipes.

Options ​

mosaic get [OPTIONS] [DOI]
ArgumentValueDescription
DOITEXTDOI of the paper to download (optional)
OptionValueDefaultDescription
--fromPATHBibTeX (.bib) or CSV (.csv) file containing DOIs to bulk-download
--oa-onlyTreat unresolvable papers as skipped rather than failed
--download-dirTEXTOverride PDF download directory for this run
--zoteroExport downloaded paper(s) to Zotero
--zotero-collectionTEXTZotero collection name (created if missing)
--zotero-localForce Zotero local API even when an API key is configured
--obsidianExport paper(s) as notes to an Obsidian vault
--obsidian-folderTEXTOverride Obsidian vault subfolder for this run
--interactive, -iRetry failed papers in a visible browser where you can log in or solve checks
--handoffOpen failed papers in your own browser and file the PDFs you download (works where publishers block automated browsers, e.g. Elsevier)
--autoRetry failed papers with your own Chrome driven by mosaic over CDP (the Elsevier-included real-browser pass; needs Chrome/Edge installed)
--max-autoINTEGER RANGE50Papers --auto may attempt per run (it drives a real browser: keep it sane)
--watch-dirPATHBrowser download folder for --handoff (default: auto-detect)
--batchINTEGER RANGE1Papers --handoff opens at once; download them in any order

Released under GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT, at your choice.