From 13d8fa8f46e644ecc591f09b1a386759fc53d19e Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Tue, 20 Jun 2017 23:40:10 +0200 Subject: Updated the way profiles are exported. --- profile.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/profile.py b/profile.py index 38853a7..eff89e1 100644 --- a/profile.py +++ b/profile.py @@ -134,21 +134,34 @@ class TinderProfile(object): if not os.path.exists(dest): os.makedirs(dest) - with open(dest + os.sep + 'info.txt', 'w') as f: + with open(dest + os.sep + self._name + '-info.txt', 'w') as f: f.write(str(self)) + counter = 0 + for p in self._photos: response = requests.get(p['url'], stream=True) if response.status_code == 200: - name = os.path.basename(p['url']) + name = self._id + '-' + self._name + '-' + + age = self.compute_age() + + if age: + name += '%d' % int(age) + '-' + + filename = os.path.basename(p['url']) + + name += '%d' % counter + filename[filename.find('.'):] with open(dest + os.sep + name, 'wb') as f: for chunk in response: f.write(chunk) + counter += 1 + def compute_age(self): """Provide the age of the Tinder user.""" -- cgit v0.11.2-87-g4458