Skip to content

Instantly share code, notes, and snippets.

@karno
Created June 5, 2017 12:40
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 karno/fcd0e3bc442bafb054c617971292656b to your computer and use it in GitHub Desktop.
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.
#!/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