Skip to content

Commit

Permalink
htmlLang
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Nov 9, 2024
1 parent f0f677f commit 23939b4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 25 deletions.
2 changes: 1 addition & 1 deletion AuthorHours.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"time":"490h24m48s"}
{"time":"492h27m22s"}
59 changes: 35 additions & 24 deletions firefox/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const isMobile = /mobile|streamingEnhanced/i.test(ua);
const isEdge = /edg/i.test(ua);
// const isFirefox = /firefox/i.test(ua);
// const isChrome = /chrome/i.test(ua);
const htmlLang = document.documentElement.lang;
const version = "1.1.46";
if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO) {
/* eslint-env root:true */
Expand Down Expand Up @@ -365,30 +366,40 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
if (isNetflix) title = card?.parentElement?.getAttribute("aria-label").split(" – ")[0];
// S2: E3 remove this part
else if (isDisney) {
title = card
?.getAttribute("aria-label")
?.replace(" Disney+ Original", "")
?.replace(" STAR Original", "")
?.replace(" Select for details on this title.", "")
?.replace(/Nummer \d* /, "")
?.replace(/Number \d* /, "")
// big title cards in the beginning of the page
.split(" Season")[0]
// individual episodes
.split("Season")[0]
.split(" New ")[0]
.split(" All ")[0]
.split(" Streaming ")[0]
// german translation
.split(" Für Details")[0]
.split(" Staffel")[0]
.split("Staffel")[0]
.split(" Neue")[0]
.split(" Alle")[0]
.split(" Jeden")[0]
.split(" Altersfreigabe")[0]
.split(" Demnächst")[0]
.split(" Premiere")[0];
title = card?.getAttribute("aria-label")?.replace(" Disney+ Original", "")?.replace(" STAR Original", "");
// german translation
if (htmlLang == "de") {
title = title
?.replace(/Nummer \d* /, "")
.split(" Für Details")[0]
.split(" Staffel")[0]
.split("Staffel")[0]
.split(" Neue")[0]
.split(" Alle")[0]
//
.split(" Jeden")[0]
//
.split(" Demnächst")[0]
.split(" Premiere")[0]
.split(" Altersfreigabe")[0]
//
.split(" Noch")[0];
} else if (htmlLang == "en") {
title = title
?.replace(/Number \d* /, "")
.replace(" Select for details on this title.", "")
.split(" Season")[0]
.split("Season")[0]
.split(" New ")[0]
.split(" All Episodes")[0]
//
.split(" Streaming ")[0]
//
.split(" Coming Soon")[0]
.split(" Two-Episode")[0]
.split(" Rated")[0];
}

if (title.includes(" minutes remaining")) title = title.replace(/ \d+ minutes remaining/g, "");
} else if (isHotstar) title = card?.getAttribute("alt")?.replace(/(S\d+\sE\d+)/g, "");
// amazon
Expand Down

0 comments on commit 23939b4

Please sign in to comment.