1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2025-01-20 06:35:20 +00:00
modufur/src/main/utils/scraper.py
2017-10-14 21:54:29 -04:00

19 lines
447 B
Python

from bs4 import BeautifulSoup
from lxml import html
from misc import exceptions as exc
from utils import utils as u
async def check_match(url):
r = await u.fetch('http://iqdb.harry.lu/?url={}'.format(url))
try:
value = BeautifulSoup(await r.read(), 'html.parser').find_all('a')[1].get('href')
except IndexError:
raise exc.MatchError
if value != '#':
return value
else:
raise exc.MatchError