🚸 Made output html instead of txt

This commit is contained in:
2021-04-06 18:24:54 +03:00
parent 1d88d0e936
commit 9107c3a0f4
4 changed files with 51 additions and 28 deletions

View File

@@ -5,5 +5,9 @@ import requests
def detect(url):
response = requests.get(url)
img = Image.open(io.BytesIO(response.content))
try:
img = Image.open(io.BytesIO(response.content))
except OSError:
return ''
return pytesseract.image_to_string(img, lang='rus', timeout=30).lower()

View File

@@ -1,8 +1,11 @@
from rich.console import Console
import calendar;
import time;
c = Console()
ts = calendar.timegm(time.gmtime())
def save_photo(url):
f = open("output.txt", "a", encoding='utf-8')
f.write(url)
f = open(f"output/{ts}.html", "a", encoding='utf-8')
f.write(f'<img width=400 src="{url}"><br>')
f.close()