1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 21:02:38 +00:00

Change HTML sanitization to be more simplistic

This commit is contained in:
Myned 2019-09-29 23:57:00 -04:00
parent f128f4b675
commit 496d5bc00c
No known key found for this signature in database
GPG key ID: BC58C09870A63E59

View file

@ -43,9 +43,10 @@ from utils import utils as u
async def query_kheina(url): async def query_kheina(url):
content = await u.fetch('https://kheina.com', params={'url': url}, text=True) 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') 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) results = ast.literal_eval(results)
iqdbdata = soup.find('data', id='iqdbdata').string iqdbdata = soup.find('data', id='iqdbdata').string
iqdbdata = ast.literal_eval(iqdbdata) iqdbdata = ast.literal_eval(iqdbdata)