Created
February 17, 2016 04:43
-
-
Save bdcorps/2dc49ce0657cbe7417da to your computer and use it in GitHub Desktop.
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
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| import urllib | |
| import os, sys | |
| base = 'https://garfield.com/' | |
| y = input("From what year would you like the comics?") | |
| directory = raw_input ("Where to save?"); | |
| if not os.path.exists(directory): | |
| os.makedirs(directory, 0755) | |
| for year in range(y,y+1): | |
| for month in range(1,13): | |
| for day in range(1,32): | |
| if day < 10: | |
| day = '0' + str(day) | |
| if month < 10: | |
| month = '0' + str(month) | |
| url = base + 'uploads/strips/' + str(year) + '-' + str(month) + '-' + str(day) + '.jpg' | |
| print url | |
| urllib.urlretrieve(url,directory+'\\' + str(year) + '-' + str(month) + '-' + str(day) + '.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment