Skip to content

Instantly share code, notes, and snippets.

@hubgit
Last active April 11, 2021 08:09
Show Gist options
  • Select an option

  • Save hubgit/c0ee395e8e500fbcd2aa4668c2c5e0bf to your computer and use it in GitHub Desktop.

Select an option

Save hubgit/c0ee395e8e500fbcd2aa4668c2c5e0bf to your computer and use it in GitHub Desktop.
Fetch the collection of COVID-19/SARS-CoV-2 preprints metadata from medRxiv and bioRxiv
// https://api.biorxiv.org/covid19/help
let cursor = 0
do {
const url = `https://api.biorxiv.org/covid19/${cursor}`
const response = await fetch(url)
const { messages: [message], collection } = await response.json()
console.log(message)
if (message.status !== 'ok') {
break
}
for (const item of collection) {
yield { item }
}
cursor += message.count
yield { progress: { value: cursor, max: message.total }}
if (cursor > message.total) {
break
}
} while (true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment