Skip to content

Instantly share code, notes, and snippets.

@carlsmith
Last active May 2, 2018 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlsmith/05e75a2d4e4b34eac87ab62606542dc7 to your computer and use it in GitHub Desktop.
Save carlsmith/05e75a2d4e4b34eac87ab62606542dc7 to your computer and use it in GitHub Desktop.
This Python function downloads a given range of Phaser World back issues.
def download(issues):
"""This function downloads a given range of Phaser World back
issues into the current working directory. Any arguments will
be passed to the `range` function to define the list of issue
numbers that will be downloaded."""
import os
url_template = "https://phaser.io/images/newsletter/pdf/issue{}.pdf"
pdf_template = '"./PhaserWorld{}.pdf"'
cmd_template = "curl -o {} {}"
for n in range(*issues):
url = url_template.format(n)
pdf = pdf_template.format(n)
cmd = cmd_template.format(path, url)
os.system(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment