1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 22:27:28 +00:00

get_image() from post

This commit is contained in:
Myned 2017-10-16 02:06:33 -04:00
parent 5c453cad41
commit 3de252c96b

View file

@ -7,7 +7,7 @@ from misc import exceptions as exc
from utils import utils as u 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}) content = await u.fetch('http://iqdb.harry.lu', params={'url': url})
try: try:
@ -22,3 +22,12 @@ async def check_match(url):
except AttributeError: except AttributeError:
raise exc.MissingArgument 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