Created
June 5, 2017 12:40
-
-
Save karno/fcd0e3bc442bafb054c617971292656b to your computer and use it in GitHub Desktop.
download urara stamps (http://www.tbs.co.jp/anime/urara/special/special03.html) with python3.
This file contains 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
#!/usr/local/bin/python3 | |
import urllib.request | |
urlfmt = "http://www.tbs.co.jp/anime/urara/special/img/stamp_{0:02d}/{1:02d}.png" | |
fnfmt = "{0:02d}_{1:02d}.png" | |
for di in range(1, 13): | |
for fi in range(1, 100): | |
try: | |
url = urlfmt.format(di, fi) | |
fn = fnfmt.format(di, fi) | |
print("downloading: {0} ... ".format(url)); | |
print(" -> {0} ... ".format(fn), end='', flush=True); | |
urllib.request.urlretrieve(url, fn) | |
print("complete."); | |
except urllib.error.HTTPError as e: | |
print("error: {0}".format(e.code)); | |
if e.code == 404: | |
print("go to next dir..."); | |
break | |
print("completed."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment