diff --git a/src/main/utils/scraper.py b/src/main/utils/scraper.py index 73b03e6..1c4fabc 100644 --- a/src/main/utils/scraper.py +++ b/src/main/utils/scraper.py @@ -7,7 +7,7 @@ from misc import exceptions as exc from utils import utils as u -async def check_match(url): +async def get_post(url): content = await u.fetch('http://iqdb.harry.lu', params={'url': url}) try: @@ -22,3 +22,12 @@ async def check_match(url): except AttributeError: raise exc.MissingArgument + + +async def get_image(url): + content = await u.fetch(url) + + value = html.fromstring(content).xpath( + 'string(/html/body/div[@id="content"]/div[@id="post-view"]/div[@class="content"]/div[2]/img/@src)') + + return value