mirror of
https://github.com/myned/modufur.git
synced 2024-12-24 22:27:28 +00:00
Caught argument errors and rxed the exception for output
This commit is contained in:
parent
2cf9faf08f
commit
9ca2a745d9
1 changed files with 10 additions and 5 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import re
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from lxml import html
|
from lxml import html
|
||||||
|
|
||||||
|
@ -10,10 +12,13 @@ async def check_match(url):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
value = BeautifulSoup(content, 'html.parser').find_all('a')[1].get('href')
|
value = BeautifulSoup(content, 'html.parser').find_all('a')[1].get('href')
|
||||||
except IndexError:
|
|
||||||
raise exc.MatchError(url)
|
|
||||||
|
|
||||||
if value != '#':
|
if value != '#':
|
||||||
return value
|
return value
|
||||||
else:
|
else:
|
||||||
raise exc.MatchError(url)
|
raise IndexError
|
||||||
|
except IndexError:
|
||||||
|
try:
|
||||||
|
raise exc.MatchError(re.search('\/([^\/]+)$', url).group(1))
|
||||||
|
|
||||||
|
except AttributeError:
|
||||||
|
raise exc.MissingArgument
|
||||||
|
|
Loading…
Reference in a new issue