summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--profile.py17
1 files 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."""