Skip to content

Instantly share code, notes, and snippets.

@who-you-me
Last active December 10, 2015 00:39
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 who-you-me/4353286 to your computer and use it in GitHub Desktop.
Save who-you-me/4353286 to your computer and use it in GitHub Desktop.
# -*- 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