Skip to content

Commit

Permalink
getMovieInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Sep 15, 2023
1 parent 3477e71 commit 3c48f65
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions firefox/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,11 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar) {
}
// justWatchAPI
async function getMovieInfo(movieTitle, locale = "en_US") {
console.log("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);
const justWatchURL = "https://www.justwatch.com" + data.items[0].full_path;
// flatrate = free with subscription (netflix, amazon prime, disney+)
let offers = 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"));
Expand Down Expand Up @@ -477,6 +479,30 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar) {
}
}

getMovieInfo("Lucifer").then((data) => {
console.log(data);
});
async function Netflix_JustWatch() {
console.log("JustWatch");
let titleCards = document.querySelectorAll(".title-card .boxart-container");
titleCards.forEach((card) => {
let title = card.children?.[1]?.firstChild.textContent;
if (title) {
// getMovieInfo(title).then((data) => {
let div = document.createElement("div");
div.style = "position: absolute;top: 0;left: 50px;z-index: 9999;color: black;background: grey;";
div.id = "justWatch";
// div.textContent = title + " " + data.scoring?.value;
div.textContent = title;
card.appendChild(div);
// });
}
});
}
// setTimeout(function () {
Netflix_JustWatch();
// }, 1000);

// Amazon Observers
const AmazonVideoClass = "#dv-web-player > div > div:nth-child(1) > div > div > div.scalingVideoContainer > div.scalingVideoContainerBottom > div > video";

Expand Down

0 comments on commit 3c48f65

Please sign in to comment.