mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
text
This commit is contained in:
@@ -28,7 +28,9 @@ def get_from_scraper(scrape, request):
|
||||
source_url = scrape.url
|
||||
except Exception:
|
||||
pass
|
||||
if source_url:
|
||||
if source_url == "https://urlnotfound.none" or not source_url:
|
||||
recipe_json['source_url'] = ''
|
||||
else:
|
||||
recipe_json['source_url'] = source_url
|
||||
try:
|
||||
keywords.append(source_url.replace('http://', '').replace('https://', '').split('/')[0])
|
||||
|
||||
@@ -1458,9 +1458,9 @@ class RecipeUrlImportView(APIView):
|
||||
data = "<script type='application/ld+json'>" + json.dumps(data_json) + "</script>"
|
||||
except JSONDecodeError:
|
||||
pass
|
||||
scrape = scrape_html(html=data, org_url=url, supported_only=False)
|
||||
scrape = scrape_html(html=data, org_url='https://urlnotfound.none', supported_only=False)
|
||||
if not url and (found_url := scrape.schema.data.get('url', 'https://urlnotfound.none')):
|
||||
scrape = scrape_html(text=data, url=found_url, supported_only=False)
|
||||
scrape = scrape_html(html=data, org_url=found_url, supported_only=False)
|
||||
|
||||
if scrape:
|
||||
return Response({
|
||||
|
||||
Reference in New Issue
Block a user