fix search by url error

This commit is contained in:
Your Name 2022-03-20 12:57:23 -04:00
parent 573789be00
commit 4924f5f248
2 changed files with 2 additions and 2 deletions

View file

@ -231,7 +231,7 @@ def get_scraper_by_url(url):
parsed_url = urllib.parse.urlparse(url)
hostname = parsed_url.netloc
for host in scraper_registry:
if host == hostname:
if host in url:
return scraper_registry[host]
# TODO move this logic to scraper class
try:

View file

@ -392,7 +392,7 @@ def jump_or_scrape(request, url):
scraper = get_scraper_by_url(url)
if scraper is None:
# invalid url
return render(request, 'common/error.html', {'msg': _("链接非法,查询失败")})
return render(request, 'common/error.html', {'msg': _("链接无效,查询失败")})
else:
try:
# raise ObjectDoesNotExist