1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-27 07:17:28 +00:00
modufur/src/main/utils/scraper.py

18 lines
426 B
Python
Raw Normal View History

import aiohttp as aio
2017-09-24 15:05:28 +00:00
from bs4 import BeautifulSoup
from lxml import html
2017-09-24 15:05:28 +00:00
from misc import exceptions as exc
from utils import utils as u
2017-09-24 15:05:28 +00:00
async def check_match(url):
r = await u.fetch('http://iqdb.harry.lu/?url={}'.format(url))
soup = BeautifulSoup(await r.read(), 'html.parser')
2017-09-24 15:05:28 +00:00
value = soup.find_all('a')[1].get('href')
2017-09-24 15:05:28 +00:00
if value != '#':
return value
else:
raise exc.MatchError(value)