diff --git a/main.py b/main.py index 3c2ebfc..4aacbed 100644 --- a/main.py +++ b/main.py @@ -79,7 +79,7 @@ while True: photos_saved += 1 save_photo(image_url) - sleep(1) + #sleep(1) except KeyboardInterrupt: c.print(' Goodbye!', style='blue') diff --git a/utils/detect.py b/utils/detect.py index e501c64..074c5ef 100644 --- a/utils/detect.py +++ b/utils/detect.py @@ -7,7 +7,8 @@ def detect(url): response = requests.get(url) try: img = Image.open(io.BytesIO(response.content)) - except OSError: - return '' - - return pytesseract.image_to_string(img, lang='rus', timeout=30).lower() + string = pytesseract.image_to_string(img, lang='rus', timeout=30).lower() + except OSError: # Happens when whatever we get is not an image and cant be opened as such + string = '' + + return string