diff --git a/justWatchTest.js b/justWatchTest.js index 90285d7e..3f469fcd 100644 --- a/justWatchTest.js +++ b/justWatchTest.js @@ -3,11 +3,15 @@ async function getMovieInfo(movieTitle) { 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); + // console.log(data); const loc = data.items[0].full_path; const opts = { url: `https://www.justwatch.com${loc}` }; - console.log(opts); + // console.log(opts); + // console.log(data.items[0].offers.filter((x) => x.monetization_type != "flatrate" && x.monetization_type != "rent" && x.monetization_type != "buy")); + console.log(data.items[0].offers.filter((x) => x.monetization_type == "flatrate" && (x.package_short_name == "amp" || x.package_short_name == "nfx" || x.package_short_name == "dnp"))); } -let movieTitle = "Three Thousand Years of Longing"; +// let movieTitle = "The Thousand Years of Longing"; +// let movieTitle = "Breaking Bad"; +let movieTitle = "Elemental"; getMovieInfo(movieTitle); diff --git a/test.json b/test.json new file mode 100644 index 00000000..c3724f1b --- /dev/null +++ b/test.json @@ -0,0 +1,68 @@ +[ + { + jw_entity_id: 'tm912189', + monetization_type: 'flatrate', + provider_id: 337, + package_short_name: 'dnp', + currency: 'USD', + urls: { + standard_web: 'https://disneyplus.bn5x.net/c/1206980/705874/9358?u=https%3A%2F%2Fwww.disneyplus.com%2Fmovies%2Felemental%2F1B2ZQ9GF35W5&subId3=justappsvod', + deeplink_web: 'https://www.disneyplus.com/video/e3895d1d-a979-4c1a-ba66-1bf706e145ab', + deeplink_android_tv: 'intent://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5#Intent;launchFlags=0x00800000;scheme=https;end', + deeplink_fire_tv: 'intent://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5#Intent;launchFlags=0x00800000;scheme=https;end', + deeplink_tvos: 'disneyplus://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5', + deeplink_tizenos: '{"id":"MCmYXNxgcu.DisneyPlus","action_data":"{\\"page\\": \\"movie_details\\", \\"type\\": \\"movies\\", \\"id\\": \\"1B2ZQ9GF35W5\\", \\"pid\\": \\"SmartHubPub\\"}"}', + deeplink_webos: '{ "id": "com.disney.disneyplus-prod", "params": { "contentTarget": "" }}', + deeplink_xbox: 'disneyplus://video/e3895d1d-a979-4c1a-ba66-1bf706e145ab', + deeplink_rokuos: 'launch/291097?contentID=e3895d1d-a979-4c1a-ba66-1bf706e145ab&MediaType=movie' + }, + available_from: '0001-01-01T00:00:00Z', + available_to: '0001-01-01T00:00:00Z', + presentation_type: '4k', + country: 'US' + }, + { + jw_entity_id: 'tm912189', + monetization_type: 'flatrate', + provider_id: 337, + package_short_name: 'dnp', + currency: 'USD', + urls: { + standard_web: 'https://disneyplus.bn5x.net/c/1206980/705874/9358?u=https%3A%2F%2Fwww.disneyplus.com%2Fmovies%2Felemental%2F1B2ZQ9GF35W5&subId3=justappsvod', + deeplink_web: 'https://www.disneyplus.com/video/e3895d1d-a979-4c1a-ba66-1bf706e145ab', + deeplink_android_tv: 'intent://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5#Intent;launchFlags=0x00800000;scheme=https;end', + deeplink_fire_tv: 'intent://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5#Intent;launchFlags=0x00800000;scheme=https;end', + deeplink_tvos: 'disneyplus://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5', + deeplink_tizenos: '{"id":"MCmYXNxgcu.DisneyPlus","action_data":"{\\"page\\": \\"movie_details\\", \\"type\\": \\"movies\\", \\"id\\": \\"1B2ZQ9GF35W5\\", \\"pid\\": \\"SmartHubPub\\"}"}', + deeplink_webos: '{ "id": "com.disney.disneyplus-prod", "params": { "contentTarget": "" }}', + deeplink_xbox: 'disneyplus://video/e3895d1d-a979-4c1a-ba66-1bf706e145ab', + deeplink_rokuos: 'launch/291097?contentID=e3895d1d-a979-4c1a-ba66-1bf706e145ab&MediaType=movie' + }, + available_from: '0001-01-01T00:00:00Z', + available_to: '0001-01-01T00:00:00Z', + presentation_type: 'hd', + country: 'US' + }, + { + jw_entity_id: 'tm912189', + monetization_type: 'flatrate', + provider_id: 337, + package_short_name: 'dnp', + currency: 'USD', + urls: { + standard_web: 'https://disneyplus.bn5x.net/c/1206980/705874/9358?u=https%3A%2F%2Fwww.disneyplus.com%2Fmovies%2Felemental%2F1B2ZQ9GF35W5&subId3=justappsvod', + deeplink_web: 'https://www.disneyplus.com/video/e3895d1d-a979-4c1a-ba66-1bf706e145ab', + deeplink_android_tv: 'intent://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5#Intent;launchFlags=0x00800000;scheme=https;end', + deeplink_fire_tv: 'intent://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5#Intent;launchFlags=0x00800000;scheme=https;end', + deeplink_tvos: 'disneyplus://www.disneyplus.com/movies/elemental/1B2ZQ9GF35W5', + deeplink_tizenos: '{"id":"MCmYXNxgcu.DisneyPlus","action_data":"{\\"page\\": \\"movie_details\\", \\"type\\": \\"movies\\", \\"id\\": \\"1B2ZQ9GF35W5\\", \\"pid\\": \\"SmartHubPub\\"}"}', + deeplink_webos: '{ "id": "com.disney.disneyplus-prod", "params": { "contentTarget": "" }}', + deeplink_xbox: 'disneyplus://video/e3895d1d-a979-4c1a-ba66-1bf706e145ab', + deeplink_rokuos: 'launch/291097?contentID=e3895d1d-a979-4c1a-ba66-1bf706e145ab&MediaType=movie' + }, + available_from: '0001-01-01T00:00:00Z', + available_to: '0001-01-01T00:00:00Z', + presentation_type: 'sd', + country: 'US' + } +]