mirror of
https://github.com/myned/modufur.git
synced 2024-12-24 14:27:27 +00:00
Fix some reasons bot may encounter HTTP exceptions when reversing images
This commit is contained in:
parent
739449b940
commit
33c6f8e797
1 changed files with 6 additions and 1 deletions
|
@ -26,13 +26,18 @@ async def get_post(url):
|
||||||
if value != '#':
|
if value != '#':
|
||||||
ident = re.search('show/([0-9]+)', value).group(1)
|
ident = re.search('show/([0-9]+)', value).group(1)
|
||||||
post = await u.fetch('http://e621.net/post/show.json', params={'id': ident}, json=True)
|
post = await u.fetch('http://e621.net/post/show.json', params={'id': ident}, json=True)
|
||||||
|
|
||||||
|
if (post['status'] == 'deleted'):
|
||||||
|
ident = re.search('#(\\d+)', post['delreason']).group(1)
|
||||||
|
post = await u.fetch('http://e621.net/post/show.json', params={'id': ident}, json=True)
|
||||||
|
|
||||||
return post
|
return post
|
||||||
else:
|
else:
|
||||||
raise IndexError
|
raise IndexError
|
||||||
|
|
||||||
except IndexError:
|
except IndexError:
|
||||||
try:
|
try:
|
||||||
raise exc.MatchError(re.search('\/([^\/]+)$', url).group(1))
|
raise exc.MatchError(re.search('\\/([^\\/]+)$', url).group(1))
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise exc.MissingArgument
|
raise exc.MissingArgument
|
||||||
|
|
Loading…
Reference in a new issue