Last active
May 2, 2018 02:55
-
-
Save carlsmith/05e75a2d4e4b34eac87ab62606542dc7 to your computer and use it in GitHub Desktop.
This Python function downloads a given range of Phaser World back issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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