From 496d5bc00cd1e78157c6b6e8afeee7d644aa8311 Mon Sep 17 00:00:00 2001 From: Myned Date: Sun, 29 Sep 2019 23:57:00 -0400 Subject: [PATCH] Change HTML sanitization to be more simplistic --- 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 05888c9..fa184da 100644 --- a/src/utils/scraper.py +++ b/src/utils/scraper.py @@ -43,9 +43,10 @@ from utils import utils as u async def query_kheina(url): content = await u.fetch('https://kheina.com', params={'url': url}, text=True) - content = content.replace('"', 'quot;').replace(''', 'apos;') + for e in ('"', '''): + content = content.replace(e, '') soup = BeautifulSoup(content, 'html5lib') - results = soup.find('data', id='results').string.replace('quot;', '"').replace('apos;', ''') + results = soup.find('data', id='results').string results = ast.literal_eval(results) iqdbdata = soup.find('data', id='iqdbdata').string iqdbdata = ast.literal_eval(iqdbdata)