3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License version 2 as
5
# published by the Free Software Foundation
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
################################################################
17
# get_bornloser_strips.py -- fetch strips of last N days
19
################################################################
24
path_prefix = '/tmp/' # where do you want to save the files?
27
################################################################
33
from string import join
34
from datetime import datetime, timedelta
37
number_of_days = int(sys.argv[1])
39
pattern = re.compile('str_strip[0-9/]+\\.full\\.gif')
40
pattern2 = re.compile('str_strip[0-9/]+\\.full\\.jpg')
41
temp1 = 'http://comics.com/ferdnand/%s/'
42
temp2 = 'http://assets.comics.com/dyn/%s'
44
date = datetime.today()
45
one_day = timedelta(1)
49
for i in range(number_of_days):
50
url = temp1 % (date.strftime('%Y%m%d'))
52
fil = urllib.urlopen(url)
54
match = pattern.search(line)
56
filename = match.group()
59
match2 = pattern2.search(line)
61
filename = match2.group()
66
url = temp2 % (filename)
68
fil = urllib.urlopen(url)
69
diskfile = file(path_prefix + 'dilbert.gif', 'w')
70
diskfile.write(fil.read())