diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-06-20 21:40:10 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-06-20 21:40:10 (GMT) |
commit | 13d8fa8f46e644ecc591f09b1a386759fc53d19e (patch) | |
tree | 8d3e377ebdf637983248cb6f9648e7882e20fb79 | |
parent | 1cefbd13c36fe125d11ef4a650880ce18f84d4b0 (diff) |
Updated the way profiles are exported.
-rw-r--r-- | profile.py | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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.""" |