mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 14:47:29 +00:00
get_image() from post
This commit is contained in:
parent
5c453cad41
commit
3de252c96b
1 changed files with 10 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue