mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 06:37:29 +00:00
Fix extraneous errors messing up fallbacks
This commit is contained in:
parent
f5ef45f8ee
commit
02116ee1e1
1 changed files with 15 additions and 7 deletions
|
@ -41,9 +41,10 @@ from utils import utils as u
|
||||||
|
|
||||||
|
|
||||||
async def query_kheina(url):
|
async def query_kheina(url):
|
||||||
content = await u.fetch('https://kheina.com', params={'url': url}, text=True)
|
try:
|
||||||
|
content = await u.fetch('https://kheina.com', params={'url': url}, text=True)
|
||||||
|
|
||||||
for e in ('"', '''):
|
for e in ('"', '''):
|
||||||
content = content.replace(e, '')
|
content = content.replace(e, '')
|
||||||
content = re.sub('<a href="/cdn-cgi/l/email-protection".+</a>', '', content)
|
content = re.sub('<a href="/cdn-cgi/l/email-protection".+</a>', '', content)
|
||||||
|
|
||||||
|
@ -74,13 +75,17 @@ async def query_kheina(url):
|
||||||
'database': 'Kheina'
|
'database': 'Kheina'
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
async def query_saucenao(url):
|
async def query_saucenao(url):
|
||||||
content = await u.fetch(
|
try:
|
||||||
'https://saucenao.com/search.php',
|
content = await u.fetch(
|
||||||
params={'url': url, 'api_key': u.config['saucenao_api'], 'output_type': 2},
|
'https://saucenao.com/search.php',
|
||||||
|
params={'url': url, 'api_key': u.config['saucenao_api'], 'output_type': 2},
|
||||||
json=True)
|
json=True)
|
||||||
|
|
||||||
if content['header'].get('message', '') in (
|
if content['header'].get('message', '') in (
|
||||||
|
@ -119,7 +124,10 @@ async def query_saucenao(url):
|
||||||
'database': 'SauceNAO'
|
'database': 'SauceNAO'
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
async def get_post(url):
|
async def get_post(url):
|
||||||
|
|
Loading…
Reference in a new issue