Last active
December 10, 2015 00:39
-
-
Save who-you-me/4353286 to your computer and use it in GitHub Desktop.
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
# -*- coding: utf- 8 -*- | |
import os | |
import urllib | |
from teams import teams, teams_old | |
URL = "http://bis.npb.or.jp/%s/stats/id%s1_%s.html" | |
PATH = "./html/%s_%s_%s.html" | |
def crawling(year, mode, team): | |
url = URL % (year, mode, team) | |
path = PATH % (year, mode, team) | |
urllib.urlretrieve(url, path) | |
if __name__ == "__main__": | |
if not os.path.exists("html"): | |
os.mkdir("html") | |
years = range(2005, 2013) | |
for year in years: | |
print year | |
if year < 2012: | |
ts = teams_old | |
else: | |
ts = teams | |
for t in ts: | |
crawling(year, 'b', t) | |
crawling(year, 'p', t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment