-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1da8a21
commit 06b7c10
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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); | ||
} |