Created
October 5, 2019 09:11
-
-
Save joelbarmettlerUZH/2fc37702e7867088c68288d255ee0387 to your computer and use it in GitHub Desktop.
Download Images of Tinder Accounds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# At the top of auto_tinder.py | |
PROF_FILE = "./images/unclassified/profiles.txt" | |
# inside the Person-class | |
def download_images(self, folder=".", sleep_max_for=0): | |
with open(PROF_FILE, "r") as f: | |
lines = f.readlines() | |
if self.id in lines: | |
return | |
with open(PROF_FILE, "a") as f: | |
f.write(self.id+"\r\n") | |
index = -1 | |
for image_url in self.images: | |
index += 1 | |
req = requests.get(image_url, stream=True) | |
if req.status_code == 200: | |
with open(f"{folder}/{self.id}_{self.name}_{index}.jpeg", "wb") as f: | |
f.write(req.content) | |
sleep(random()*sleep_max_for) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment