From 4b3976caf416275f22ab46b923d9b5c8c1479033 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Thu, 22 Aug 2013 22:52:23 +0200 Subject: [PATCH] Downloading photos is done via diaspy.settings.Settings --- sensual_asa_cat.py | 59 ---------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 sensual_asa_cat.py diff --git a/sensual_asa_cat.py b/sensual_asa_cat.py deleted file mode 100644 index f5616f5..0000000 --- a/sensual_asa_cat.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 - -"""Script for downloading Diaspora* user pictures. - -Named after SensualAsaCat user whose account was to be deleted after some -radikal transgender reported her to admins of joindiaspora.com for -posting *inappropriate* content. - -I disaggred with him and he can go to hell. -So, here is a script that allows you to get all of SensualAsaCat's pictures. -""" - -import getpass -import urllib.request - -import diaspy - - -guid = "b1b7d3e76ec50c7d" - -pod = input('Your pod: ') -username = input ('Your username on pod \'{0}\': '.format(pod)) -password = getpass.getpass('Password for \'{0}@{1}\': '.format(username, pod)) - -connection = diaspy.connection.Connection(pod=pod, username=username, password=password) -connection.login() - - -user = diaspy.people.User(connection, guid=guid) - -oldstream = user.stream.copy() -user.stream.more() - -while len(oldstream) != len(user.stream): - try: - oldstream = user.stream.copy() - user.stream.more() - go = True - except KeyboardInterrupt: - go = False - finally: - if go: print('Working... ({0})'.format(len(oldstream))) - -print('Posts found:', len(user.stream)) -for i, p in enumerate(oldstream): - 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: - name = '{0}.{1}'.format(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)) - finally: - pass - print('\n\n----\n') -- 2.25.1