From b6fa74c601cd786375c2f3d83cb81f443cc027ad Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 22 Aug 2024 12:45:49 -0500 Subject: [PATCH] text --- cookbook/helper/recipe_url_import.py | 4 +++- cookbook/views/api.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index a6d91f84c..aeae86f83 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -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]) diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 21a21d4e6..0090cc100 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -1458,9 +1458,9 @@ class RecipeUrlImportView(APIView): data = "" 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({