diff --git a/cookbook/templates/url_import.html b/cookbook/templates/url_import.html
index be238d7b1..040723ca2 100644
--- a/cookbook/templates/url_import.html
+++ b/cookbook/templates/url_import.html
@@ -295,7 +295,7 @@
this.recipe_data = undefined
this.error = undefined
this.loading = true
- this.$http.get("{% url 'api_recipe_from_url' 12345 %}".replace(/12345/, this.remote_url)).then((response) => {
+ this.$http.post("{% url 'api_recipe_from_url' %}", {'url' : this.remote_url}, {emulateJSON: true}).then((response) => {
this.recipe_data = response.data;
this.loading = false
}).catch((err) => {
diff --git a/cookbook/urls.py b/cookbook/urls.py
index 73944baf0..13c29c279 100644
--- a/cookbook/urls.py
+++ b/cookbook/urls.py
@@ -69,7 +69,7 @@ urlpatterns = [
path('api/sync_all/', api.sync_all, name='api_sync'),
path('api/log_cooking//', api.log_cooking, name='api_log_cooking'),
path('api/plan-ical//', api.get_plan_ical, name='api_get_plan_ical'),
- path('api/recipe-from-url//', api.recipe_from_url, name='api_recipe_from_url'),
+ path('api/recipe-from-url/', api.recipe_from_url, name='api_recipe_from_url'),
path('api/backup/', api.get_backup, name='api_backup'),
path('dal/keyword/', dal.KeywordAutocomplete.as_view(), name='dal_keyword'),
diff --git a/cookbook/views/api.py b/cookbook/views/api.py
index 5695726d2..7988fcce9 100644
--- a/cookbook/views/api.py
+++ b/cookbook/views/api.py
@@ -346,7 +346,9 @@ def get_plan_ical(request, html_week):
@group_required('user')
-def recipe_from_url(request, url):
+def recipe_from_url(request):
+ url = request.POST['url']
+
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36'}
try:
response = requests.get(url, headers=headers)