Skip to content

Commit

Permalink
IMDB read
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Aug 18, 2023
1 parent 1da8a21 commit 06b7c10
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test.js
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);
}

0 comments on commit 06b7c10

Please sign in to comment.