From ffee58656cb7df39ee9228c2052e9637376a796d Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 12 Nov 2019 16:10:25 -0500 Subject: [PATCH] Change reverse image footer to display source hostname --- src/utils/scraper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/scraper.py b/src/utils/scraper.py index 17e9753..6a50027 100644 --- a/src/utils/scraper.py +++ b/src/utils/scraper.py @@ -1,6 +1,7 @@ import aiohttp import ast import re +from urllib.parse import urlparse from bs4 import BeautifulSoup import lxml @@ -72,7 +73,7 @@ async def query_kheina(url): 'artist': match[4], 'thumbnail': f'https://f002.backblazeb2.com/file/kheinacom/{match[1]}.jpg', 'similarity': str(similarity), - 'database': 'Kheina' + 'database': urlparse(match[3].replace('\\', '')).hostname.split('.')[0] } return result @@ -124,7 +125,7 @@ async def query_saucenao(url): 'artist': artist, 'thumbnail': match['header']['thumbnail'], 'similarity': str(similarity), - 'database': 'SauceNAO' + 'database': urlparse(source).hostname.split('.')[0] } return result