Skip to content

Commit 93cc3b0

Browse files
mgurgelgithub-actions[bot]
authored andcommitted
Release build 9.3.0 [ci release]
1 parent 590f7bd commit 93cc3b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2562
-1261
lines changed

CHANGELOG.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
- build(deps-dev): bump eslint in the eslint group across 1 directory (#1717)
2-
- Add basic canvas experiment ability (#1703)
3-
- Updated Scam Blocker help page URLs (#1671)
4-
- Fix capitalisation in tracking attempts text (#1707)
1+
- Duck Player custom error copy update (#1706)

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5758,8 +5758,8 @@
57585758
display: block;
57595759
background-image: url("data:image/svg+xml,%3Csvg fill='none' viewBox='0 0 96 96' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='red' d='M47.5 70.802c1.945 0 3.484-1.588 3.841-3.5C53.076 58.022 61.218 51 71 51h4.96c2.225 0 4.04-1.774 4.04-4 0-.026-.007-9.022-1.338-14.004a8.02 8.02 0 0 0-5.659-5.658C68.014 26 48 26 48 26s-20.015 0-25.004 1.338a8.01 8.01 0 0 0-5.658 5.658C16 37.986 16 48.401 16 48.401s0 10.416 1.338 15.405a8.01 8.01 0 0 0 5.658 5.658c4.99 1.338 24.504 1.338 24.504 1.338'/%3E%3Cpath fill='%23fff' d='m41.594 58 16.627-9.598-16.627-9.599z'/%3E%3Cpath fill='%23EB102D' d='M87 71c0 8.837-7.163 16-16 16s-16-7.163-16-16 7.163-16 16-16 16 7.163 16 16'/%3E%3Cpath fill='%23fff' d='M73 77.8a2 2 0 1 1-4 0 2 2 0 0 1 4 0m-2.039-4.4c-.706 0-1.334-.49-1.412-1.12l-.942-8.75c-.079-.7.55-1.33 1.412-1.33h1.962c.785 0 1.492.63 1.413 1.33l-.942 8.75c-.157.63-.784 1.12-1.49 1.12Z'/%3E%3Cpath fill='%23CCC' d='M92.501 59c.298 0 .595.12.823.354.454.468.454 1.23 0 1.698l-2.333 2.4a1.145 1.145 0 0 1-1.65 0 1.227 1.227 0 0 1 0-1.698l2.333-2.4c.227-.234.524-.354.822-.354zm-1.166 10.798h3.499c.641 0 1.166.54 1.166 1.2s-.525 1.2-1.166 1.2h-3.499c-.641 0-1.166-.54-1.166-1.2s.525-1.2 1.166-1.2m-1.982 8.754c.227-.234.525-.354.822-.354h.006c.297 0 .595.12.822.354l2.332 2.4c.455.467.455 1.23 0 1.697a1.145 1.145 0 0 1-1.65 0l-2.332-2.4a1.227 1.227 0 0 1 0-1.697'/%3E%3C/svg%3E%0A");
57605760
background-repeat: no-repeat;
5761-
height: 48px;
5762-
width: 48px;
5761+
height: 96px;
5762+
width: 96px;
57635763
}
57645764
57655765
@media screen and (max-width: 320px) {
@@ -5912,12 +5912,76 @@ ul.messages {
59125912

59135913
// src/features/duckplayer-native/error-detection.js
59145914
init_define_import_meta_trackerLookup();
5915+
5916+
// src/features/duckplayer-native/youtube-errors.js
5917+
init_define_import_meta_trackerLookup();
59155918
var YOUTUBE_ERRORS = {
59165919
ageRestricted: "age-restricted",
59175920
signInRequired: "sign-in-required",
59185921
noEmbed: "no-embed",
59195922
unknown: "unknown"
59205923
};
5924+
var YOUTUBE_ERROR_IDS = Object.values(YOUTUBE_ERRORS);
5925+
function checkForError(errorSelector, node) {
5926+
if (node?.nodeType === Node.ELEMENT_NODE) {
5927+
const element = (
5928+
/** @type {HTMLElement} */
5929+
node
5930+
);
5931+
const isError = element.matches(errorSelector) || !!element.querySelector(errorSelector);
5932+
return isError;
5933+
}
5934+
return false;
5935+
}
5936+
function getErrorType(windowObject, signInRequiredSelector, logger) {
5937+
const currentWindow = (
5938+
/** @type {Window & typeof globalThis & { ytcfg: object }} */
5939+
windowObject
5940+
);
5941+
const currentDocument = currentWindow.document;
5942+
if (!currentWindow || !currentDocument) {
5943+
logger?.warn("Window or document missing!");
5944+
return YOUTUBE_ERRORS.unknown;
5945+
}
5946+
let playerResponse;
5947+
if (!currentWindow.ytcfg) {
5948+
logger?.warn("ytcfg missing!");
5949+
} else {
5950+
logger?.log("Got ytcfg", currentWindow.ytcfg);
5951+
}
5952+
try {
5953+
const playerResponseJSON = currentWindow.ytcfg?.get("PLAYER_VARS")?.embedded_player_response;
5954+
logger?.log("Player response", playerResponseJSON);
5955+
playerResponse = JSON.parse(playerResponseJSON);
5956+
} catch (e) {
5957+
logger?.log("Could not parse player response", e);
5958+
}
5959+
if (typeof playerResponse === "object") {
5960+
const {
5961+
previewPlayabilityStatus: { desktopLegacyAgeGateReason, status }
5962+
} = playerResponse;
5963+
if (status === "UNPLAYABLE") {
5964+
if (desktopLegacyAgeGateReason === 1) {
5965+
logger?.log("AGE RESTRICTED ERROR");
5966+
return YOUTUBE_ERRORS.ageRestricted;
5967+
}
5968+
logger?.log("NO EMBED ERROR");
5969+
return YOUTUBE_ERRORS.noEmbed;
5970+
}
5971+
}
5972+
try {
5973+
if (signInRequiredSelector && !!currentDocument.querySelector(signInRequiredSelector)) {
5974+
logger?.log("SIGN-IN ERROR");
5975+
return YOUTUBE_ERRORS.signInRequired;
5976+
}
5977+
} catch (e) {
5978+
logger?.log("Sign-in required query failed", e);
5979+
}
5980+
logger?.log("UNKNOWN ERROR");
5981+
return YOUTUBE_ERRORS.unknown;
5982+
}
5983+
5984+
// src/features/duckplayer-native/error-detection.js
59215985
var ErrorDetection = class {
59225986
/**
59235987
* @param {ErrorDetectionSettings} settings
@@ -5949,8 +6013,8 @@ ul.messages {
59496013
observe() {
59506014
const documentBody = document?.body;
59516015
if (documentBody) {
5952-
if (this.checkForError(documentBody)) {
5953-
const error = this.getErrorType();
6016+
if (checkForError(this.selectors.youtubeError, documentBody)) {
6017+
const error = getErrorType(window, this.selectors.signInRequiredError, this.logger);
59546018
this.handleError(error);
59556019
return;
59566020
}
@@ -5986,78 +6050,15 @@ ul.messages {
59866050
for (const mutation of mutationsList) {
59876051
if (mutation.type === "childList") {
59886052
mutation.addedNodes.forEach((node) => {
5989-
if (this.checkForError(node)) {
6053+
if (checkForError(this.selectors.youtubeError, node)) {
59906054
this.logger.log("A node with an error has been added to the document:", node);
5991-
const error = this.getErrorType();
6055+
const error = getErrorType(window, this.selectors.signInRequiredError, this.logger);
59926056
this.handleError(error);
59936057
}
59946058
});
59956059
}
59966060
}
59976061
}
5998-
/**
5999-
* Attempts to detect the type of error in the YouTube embed iframe
6000-
* @returns {YouTubeError}
6001-
*/
6002-
getErrorType() {
6003-
const currentWindow = (
6004-
/** @type {Window & typeof globalThis & { ytcfg: object }} */
6005-
window
6006-
);
6007-
let playerResponse;
6008-
if (!currentWindow.ytcfg) {
6009-
this.logger.warn("ytcfg missing!");
6010-
} else {
6011-
this.logger.log("Got ytcfg", currentWindow.ytcfg);
6012-
}
6013-
try {
6014-
const playerResponseJSON = currentWindow.ytcfg?.get("PLAYER_VARS")?.embedded_player_response;
6015-
this.logger.log("Player response", playerResponseJSON);
6016-
playerResponse = JSON.parse(playerResponseJSON);
6017-
} catch (e) {
6018-
this.logger.log("Could not parse player response", e);
6019-
}
6020-
if (typeof playerResponse === "object") {
6021-
const {
6022-
previewPlayabilityStatus: { desktopLegacyAgeGateReason, status }
6023-
} = playerResponse;
6024-
if (status === "UNPLAYABLE") {
6025-
if (desktopLegacyAgeGateReason === 1) {
6026-
this.logger.log("AGE RESTRICTED ERROR");
6027-
return YOUTUBE_ERRORS.ageRestricted;
6028-
}
6029-
this.logger.log("NO EMBED ERROR");
6030-
return YOUTUBE_ERRORS.noEmbed;
6031-
}
6032-
}
6033-
try {
6034-
if (document.querySelector(this.selectors.signInRequiredError)) {
6035-
this.logger.log("SIGN-IN ERROR");
6036-
return YOUTUBE_ERRORS.signInRequired;
6037-
}
6038-
} catch (e) {
6039-
this.logger.log("Sign-in required query failed", e);
6040-
}
6041-
this.logger.log("UNKNOWN ERROR");
6042-
return YOUTUBE_ERRORS.unknown;
6043-
}
6044-
/**
6045-
* Analyses a node and its children to determine if it contains an error state
6046-
*
6047-
* @param {Node} [node]
6048-
*/
6049-
checkForError(node) {
6050-
if (node?.nodeType === Node.ELEMENT_NODE) {
6051-
const { youtubeError } = this.selectors;
6052-
const element = (
6053-
/** @type {HTMLElement} */
6054-
node
6055-
);
6056-
const isError = element.matches(youtubeError) || !!element.querySelector(youtubeError);
6057-
return isError;
6058-
}
6059-
return false;
6060-
}
60616062
};
60626063

60636064
// src/features/duckplayer-native/sub-features/duck-player-native-no-cookie.js

Sources/ContentScopeScripts/dist/contentScopeIsolated.js

Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7656,8 +7656,8 @@
76567656
display: block;
76577657
background-image: url("data:image/svg+xml,%3Csvg fill='none' viewBox='0 0 96 96' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='red' d='M47.5 70.802c1.945 0 3.484-1.588 3.841-3.5C53.076 58.022 61.218 51 71 51h4.96c2.225 0 4.04-1.774 4.04-4 0-.026-.007-9.022-1.338-14.004a8.02 8.02 0 0 0-5.659-5.658C68.014 26 48 26 48 26s-20.015 0-25.004 1.338a8.01 8.01 0 0 0-5.658 5.658C16 37.986 16 48.401 16 48.401s0 10.416 1.338 15.405a8.01 8.01 0 0 0 5.658 5.658c4.99 1.338 24.504 1.338 24.504 1.338'/%3E%3Cpath fill='%23fff' d='m41.594 58 16.627-9.598-16.627-9.599z'/%3E%3Cpath fill='%23EB102D' d='M87 71c0 8.837-7.163 16-16 16s-16-7.163-16-16 7.163-16 16-16 16 7.163 16 16'/%3E%3Cpath fill='%23fff' d='M73 77.8a2 2 0 1 1-4 0 2 2 0 0 1 4 0m-2.039-4.4c-.706 0-1.334-.49-1.412-1.12l-.942-8.75c-.079-.7.55-1.33 1.412-1.33h1.962c.785 0 1.492.63 1.413 1.33l-.942 8.75c-.157.63-.784 1.12-1.49 1.12Z'/%3E%3Cpath fill='%23CCC' d='M92.501 59c.298 0 .595.12.823.354.454.468.454 1.23 0 1.698l-2.333 2.4a1.145 1.145 0 0 1-1.65 0 1.227 1.227 0 0 1 0-1.698l2.333-2.4c.227-.234.524-.354.822-.354zm-1.166 10.798h3.499c.641 0 1.166.54 1.166 1.2s-.525 1.2-1.166 1.2h-3.499c-.641 0-1.166-.54-1.166-1.2s.525-1.2 1.166-1.2m-1.982 8.754c.227-.234.525-.354.822-.354h.006c.297 0 .595.12.822.354l2.332 2.4c.455.467.455 1.23 0 1.697a1.145 1.145 0 0 1-1.65 0l-2.332-2.4a1.227 1.227 0 0 1 0-1.697'/%3E%3C/svg%3E%0A");
76587658
background-repeat: no-repeat;
7659-
height: 48px;
7660-
width: 48px;
7659+
height: 96px;
7660+
width: 96px;
76617661
}
76627662

76637663
@media screen and (max-width: 320px) {
@@ -7810,12 +7810,76 @@ ul.messages {
78107810

78117811
// src/features/duckplayer-native/error-detection.js
78127812
init_define_import_meta_trackerLookup();
7813+
7814+
// src/features/duckplayer-native/youtube-errors.js
7815+
init_define_import_meta_trackerLookup();
78137816
var YOUTUBE_ERRORS = {
78147817
ageRestricted: "age-restricted",
78157818
signInRequired: "sign-in-required",
78167819
noEmbed: "no-embed",
78177820
unknown: "unknown"
78187821
};
7822+
var YOUTUBE_ERROR_IDS = Object.values(YOUTUBE_ERRORS);
7823+
function checkForError(errorSelector, node) {
7824+
if (node?.nodeType === Node.ELEMENT_NODE) {
7825+
const element = (
7826+
/** @type {HTMLElement} */
7827+
node
7828+
);
7829+
const isError = element.matches(errorSelector) || !!element.querySelector(errorSelector);
7830+
return isError;
7831+
}
7832+
return false;
7833+
}
7834+
function getErrorType(windowObject, signInRequiredSelector, logger) {
7835+
const currentWindow = (
7836+
/** @type {Window & typeof globalThis & { ytcfg: object }} */
7837+
windowObject
7838+
);
7839+
const currentDocument = currentWindow.document;
7840+
if (!currentWindow || !currentDocument) {
7841+
logger?.warn("Window or document missing!");
7842+
return YOUTUBE_ERRORS.unknown;
7843+
}
7844+
let playerResponse;
7845+
if (!currentWindow.ytcfg) {
7846+
logger?.warn("ytcfg missing!");
7847+
} else {
7848+
logger?.log("Got ytcfg", currentWindow.ytcfg);
7849+
}
7850+
try {
7851+
const playerResponseJSON = currentWindow.ytcfg?.get("PLAYER_VARS")?.embedded_player_response;
7852+
logger?.log("Player response", playerResponseJSON);
7853+
playerResponse = JSON.parse(playerResponseJSON);
7854+
} catch (e) {
7855+
logger?.log("Could not parse player response", e);
7856+
}
7857+
if (typeof playerResponse === "object") {
7858+
const {
7859+
previewPlayabilityStatus: { desktopLegacyAgeGateReason, status }
7860+
} = playerResponse;
7861+
if (status === "UNPLAYABLE") {
7862+
if (desktopLegacyAgeGateReason === 1) {
7863+
logger?.log("AGE RESTRICTED ERROR");
7864+
return YOUTUBE_ERRORS.ageRestricted;
7865+
}
7866+
logger?.log("NO EMBED ERROR");
7867+
return YOUTUBE_ERRORS.noEmbed;
7868+
}
7869+
}
7870+
try {
7871+
if (signInRequiredSelector && !!currentDocument.querySelector(signInRequiredSelector)) {
7872+
logger?.log("SIGN-IN ERROR");
7873+
return YOUTUBE_ERRORS.signInRequired;
7874+
}
7875+
} catch (e) {
7876+
logger?.log("Sign-in required query failed", e);
7877+
}
7878+
logger?.log("UNKNOWN ERROR");
7879+
return YOUTUBE_ERRORS.unknown;
7880+
}
7881+
7882+
// src/features/duckplayer-native/error-detection.js
78197883
var ErrorDetection = class {
78207884
/**
78217885
* @param {ErrorDetectionSettings} settings
@@ -7847,8 +7911,8 @@ ul.messages {
78477911
observe() {
78487912
const documentBody = document?.body;
78497913
if (documentBody) {
7850-
if (this.checkForError(documentBody)) {
7851-
const error = this.getErrorType();
7914+
if (checkForError(this.selectors.youtubeError, documentBody)) {
7915+
const error = getErrorType(window, this.selectors.signInRequiredError, this.logger);
78527916
this.handleError(error);
78537917
return;
78547918
}
@@ -7884,78 +7948,15 @@ ul.messages {
78847948
for (const mutation of mutationsList) {
78857949
if (mutation.type === "childList") {
78867950
mutation.addedNodes.forEach((node) => {
7887-
if (this.checkForError(node)) {
7951+
if (checkForError(this.selectors.youtubeError, node)) {
78887952
this.logger.log("A node with an error has been added to the document:", node);
7889-
const error = this.getErrorType();
7953+
const error = getErrorType(window, this.selectors.signInRequiredError, this.logger);
78907954
this.handleError(error);
78917955
}
78927956
});
78937957
}
78947958
}
78957959
}
7896-
/**
7897-
* Attempts to detect the type of error in the YouTube embed iframe
7898-
* @returns {YouTubeError}
7899-
*/
7900-
getErrorType() {
7901-
const currentWindow = (
7902-
/** @type {Window & typeof globalThis & { ytcfg: object }} */
7903-
window
7904-
);
7905-
let playerResponse;
7906-
if (!currentWindow.ytcfg) {
7907-
this.logger.warn("ytcfg missing!");
7908-
} else {
7909-
this.logger.log("Got ytcfg", currentWindow.ytcfg);
7910-
}
7911-
try {
7912-
const playerResponseJSON = currentWindow.ytcfg?.get("PLAYER_VARS")?.embedded_player_response;
7913-
this.logger.log("Player response", playerResponseJSON);
7914-
playerResponse = JSON.parse(playerResponseJSON);
7915-
} catch (e) {
7916-
this.logger.log("Could not parse player response", e);
7917-
}
7918-
if (typeof playerResponse === "object") {
7919-
const {
7920-
previewPlayabilityStatus: { desktopLegacyAgeGateReason, status }
7921-
} = playerResponse;
7922-
if (status === "UNPLAYABLE") {
7923-
if (desktopLegacyAgeGateReason === 1) {
7924-
this.logger.log("AGE RESTRICTED ERROR");
7925-
return YOUTUBE_ERRORS.ageRestricted;
7926-
}
7927-
this.logger.log("NO EMBED ERROR");
7928-
return YOUTUBE_ERRORS.noEmbed;
7929-
}
7930-
}
7931-
try {
7932-
if (document.querySelector(this.selectors.signInRequiredError)) {
7933-
this.logger.log("SIGN-IN ERROR");
7934-
return YOUTUBE_ERRORS.signInRequired;
7935-
}
7936-
} catch (e) {
7937-
this.logger.log("Sign-in required query failed", e);
7938-
}
7939-
this.logger.log("UNKNOWN ERROR");
7940-
return YOUTUBE_ERRORS.unknown;
7941-
}
7942-
/**
7943-
* Analyses a node and its children to determine if it contains an error state
7944-
*
7945-
* @param {Node} [node]
7946-
*/
7947-
checkForError(node) {
7948-
if (node?.nodeType === Node.ELEMENT_NODE) {
7949-
const { youtubeError } = this.selectors;
7950-
const element = (
7951-
/** @type {HTMLElement} */
7952-
node
7953-
);
7954-
const isError = element.matches(youtubeError) || !!element.querySelector(youtubeError);
7955-
return isError;
7956-
}
7957-
return false;
7958-
}
79597960
};
79607961

79617962
// src/features/duckplayer-native/sub-features/duck-player-native-no-cookie.js

0 commit comments

Comments
 (0)