Skip to content

Instantly share code, notes, and snippets.

@Donearm
Created February 15, 2011 10:12
Show Gist options
  • Save Donearm/827347 to your computer and use it in GitHub Desktop.
Save Donearm/827347 to your computer and use it in GitHub Desktop.
Being sick of having to use cache to download Sports Illustrated images, I wrote this quick script for 2011 edition (but changing models name and the '11_' string before filenames and urls will work for past and, hopefully, future editions too)
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c) 2011, Gianluca Fiore
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
###############################################################################
__author__ = "Gianluca Fiore"
__license__ = "GPL"
__version__ = "1.0"
__date__ = "20110215"
__email__ = "forod.g@gmail.com"
__status__ = "stable"
import sys
import urllib2
import urllib
UA = 'Mozilla/5.0 (X11; Linux x86_64; rv:2.0b11) Gecko/20100101 Firefox/4.0b11'
BASEURL = 'http://i.cdn.turner.com/si/pr/subs/swimsuit/images/'
DOWNLOADDIR = '/mnt/documents/Maidens/Uploads/si2011/'
MODELS = [ 'shannan-click', 'brooklyn-decker', 'cintia-dicker', 'kenza-fourati',
'esti-ginzburg', 'jessica-gomes', 'izabel-goulart', 'julie-henderson',
'damaris-lewis', 'alyssa-miller', 'genevieve-morton', 'hilary-rhoda',
'irina-shayk', 'chrissy-teigen', 'kate-upton', 'anne-v', 'jessica-white' ]
def main():
for m in MODELS:
# for the 2011 edition the maximum number of images per model is 56
for n in range(1, 57):
if n < 10:
filename = '11_' + m + '_0' + str(n) + '.jpg'
else:
filename = '11_' + m + '_' + str(n) + '.jpg'
url = BASEURL + filename
req = urllib2.Request(url)
req.add_header('User-Agent', UA)
try:
resp = urllib2.urlopen(req, None)
with open(DOWNLOADDIR + filename, "wb") as f:
f.write(resp.read())
except:
pass
if __name__ == '__main__':
status = main()
sys.exit(status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment