From 92cc9ec89160dec3c437ce6d416e0af46c309662 Mon Sep 17 00:00:00 2001 From: Marvin Alexander Krebber Date: Tue, 22 Aug 2023 22:53:19 +0200 Subject: [PATCH] del --- test.js | 59 --------------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 test.js diff --git a/test.js b/test.js deleted file mode 100644 index e286528f..00000000 --- a/test.js +++ /dev/null @@ -1,59 +0,0 @@ -// let title = "How I Met Your Mother"; -// title = title.replaceAll(" ", "%20"); -// const url = "https://moviesdatabase.p.rapidapi.com/titles/search/title/" + title + "?exact=true&info=base_info"; -// const options = { -// method: "GET", -// headers: { -// "X-RapidAPI-Key": "3798a400e8mshced4564d240d851p1b4f85jsn717e097775dd", -// "X-RapidAPI-Host": "moviesdatabase.p.rapidapi.com", -// }, -// }; - -// try { -// fetch(url, options) -// .then((response) => { -// if (!response.ok) { -// throw new Error("Network response was not ok"); -// } -// return response.text(); -// }) -// .then((text) => { -// console.log(text); -// }) -// .catch((error) => { -// console.error(error); -// }); -// } catch (error) { -// console.error(error); -// } - -function searchTitle(title) { - title = title.replaceAll(" ", "%20"); - const url = "https://moviesdatabase.p.rapidapi.com/titles/search/title/" + title + "?exact=true&info=base_info"; - const options = { - method: "GET", - headers: { - "X-RapidAPI-Key": "3798a400e8mshced4564d240d851p1b4f85jsn717e097775dd", - "X-RapidAPI-Host": "moviesdatabase.p.rapidapi.com", - }, - }; - - return fetch(url, options) - .then((response) => { - if (!response.ok) { - throw new Error("Network response was not ok"); - } - return response.text(); - }) - .catch((error) => { - console.error(error); - }); -} - -searchTitle("How I Met Your Mother") - .then((text) => { - console.log(text); - }) - .catch((error) => { - console.error(error); - });