Fixed a bug in sensual_asa_cat.py
authorMarek Marecki <marekjm@taistelu.com>
Sat, 10 Aug 2013 12:28:13 +0000 (14:28 +0200)
committerMarek Marecki <marekjm@taistelu.com>
Sat, 10 Aug 2013 12:28:13 +0000 (14:28 +0200)
sensual_asa_cat.py

index ec685fcb50a722483912dff86d0cccc076a6ae48..afe9ef6ad5ca952eed0fb1ff1842404b1e5d23d3 100644 (file)
@@ -42,14 +42,14 @@ while len(oldstream) != len(user.stream):
 
 print('Posts found:', len(user.stream))
 for i, p in enumerate(oldstream):
-    #print(repr(p), '\n(', p.data, ')', '\n\n----\n')
     print(repr(p))
     if p.data['photos']:
         print('Downloading photos...')
         for n, photo in enumerate(p.data['photos']):
             print('{0}/{1}'.format(n+1, len(p.data['photos'])), end='\t')
             try:
-                urllib.request.urlretrieve(url=photo['sizes']['large'], filename=photo['guid'])
+                name = photo['guid'] + photo['sizes']['large'].split('.')[-1]
+                urllib.request.urlretrieve(url=photo['sizes']['large'], filename=name)
                 print('[  OK  ]')
             except Exception as e:
                 print('[ FAIL: {0}]'.format(e))