Skip to content

Instantly share code, notes, and snippets.

@jdmichaud
Created May 2, 2021 15:15
Show Gist options
  • Select an option

  • Save jdmichaud/c0c6a301c75921e3d295ab67a30c8d91 to your computer and use it in GitHub Desktop.

Select an option

Save jdmichaud/c0c6a301c75921e3d295ab67a30c8d91 to your computer and use it in GitHub Desktop.
Extract Wikipedia dumps
#!/bin/bash
# First download the page listing all the dumps, then extract, with some brittle xpath magic the list of dump files and curl them locally.
curl -sL https://dumps.wikimedia.org/commonswiki/20210420/ | \
xidel --xpath '//li[./span[contains(@class, "title") and ./big/b/text() = "Articles, templates, media/file descriptions, and primary meta-pages."]]/ul/li/a/@href' - | \
xargs -n 1 -i curl --progress-bar -OL -C - https://dumps.wikimedia.org/{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment