From fb1de37f3ffc50f8f553ce13235f2425109b0ab0 Mon Sep 17 00:00:00 2001 From: Marvin Alexander Krebber Date: Fri, 15 Sep 2023 09:20:42 +0200 Subject: [PATCH] justWatchTest --- justWatchTest.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 justWatchTest.js diff --git a/justWatchTest.js b/justWatchTest.js new file mode 100644 index 00000000..90285d7e --- /dev/null +++ b/justWatchTest.js @@ -0,0 +1,13 @@ +async function getMovieInfo(movieTitle) { + let locale = "en_US"; + const url = `https://apis.justwatch.com/content/titles/${locale}/popular?language=en&body={"page_size":1,"page":1,"query":"${movieTitle}","content_types":["show","movie"]}`; + const response = await fetch(encodeURI(url)); + const data = await response.json(); + console.log(data); + const loc = data.items[0].full_path; + const opts = { url: `https://www.justwatch.com${loc}` }; + console.log(opts); +} + +let movieTitle = "Three Thousand Years of Longing"; +getMovieInfo(movieTitle);