mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 21:47:06 +03:00
Remove unlisted experiment
This commit is contained in:
@@ -669,12 +669,6 @@
|
|||||||
"help": {
|
"help": {
|
||||||
"message": "Help"
|
"message": "Help"
|
||||||
},
|
},
|
||||||
"experimentUnlistedTitle": {
|
|
||||||
"message": "Help prevent this from disappearing"
|
|
||||||
},
|
|
||||||
"experimentUnlistedText": {
|
|
||||||
"message": "This video is detected as unlisted and uploaded before 2017\nOld unlisted videos are being set to private next month\nWe are collecting *public* videos to back up\nWould you like to anonymously send this video to us?\nhttps://support.google.com/youtube/answer/9230970"
|
|
||||||
},
|
|
||||||
"experiementOptOut": {
|
"experiementOptOut": {
|
||||||
"message": "Opt-out of all future experiments",
|
"message": "Opt-out of all future experiments",
|
||||||
"description": "This is used in a popup about a new experiment to get a list of unlisted videos to back up since all unlisted videos uploaded before 2017 will be set to private."
|
"description": "This is used in a popup about a new experiment to get a list of unlisted videos to back up since all unlisted videos uploaded before 2017 will be set to private."
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ interface SBConfig {
|
|||||||
testingServer: boolean,
|
testingServer: boolean,
|
||||||
refetchWhenNotFound: boolean,
|
refetchWhenNotFound: boolean,
|
||||||
ytInfoPermissionGranted: boolean,
|
ytInfoPermissionGranted: boolean,
|
||||||
askAboutUnlistedVideos: boolean,
|
|
||||||
allowExpirements: boolean,
|
allowExpirements: boolean,
|
||||||
autoHideInfoButton: boolean,
|
autoHideInfoButton: boolean,
|
||||||
|
|
||||||
@@ -179,7 +178,6 @@ const Config: SBObject = {
|
|||||||
testingServer: false,
|
testingServer: false,
|
||||||
refetchWhenNotFound: true,
|
refetchWhenNotFound: true,
|
||||||
ytInfoPermissionGranted: false,
|
ytInfoPermissionGranted: false,
|
||||||
askAboutUnlistedVideos: true,
|
|
||||||
allowExpirements: true,
|
allowExpirements: true,
|
||||||
autoHideInfoButton: true,
|
autoHideInfoButton: true,
|
||||||
|
|
||||||
@@ -345,6 +343,10 @@ function fetchConfig(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function migrateOldFormats(config: SBConfig) {
|
function migrateOldFormats(config: SBConfig) {
|
||||||
|
if (config["askAboutUnlistedVideos"]) {
|
||||||
|
chrome.storage.sync.remove("askAboutUnlistedVideos");
|
||||||
|
}
|
||||||
|
|
||||||
// Adding preview category
|
// Adding preview category
|
||||||
if (!config["previewCategoryUpdate"]) {
|
if (!config["previewCategoryUpdate"]) {
|
||||||
config["previewCategoryUpdate"] = true;
|
config["previewCategoryUpdate"] = true;
|
||||||
|
|||||||
@@ -282,9 +282,6 @@ async function videoIDChange(id) {
|
|||||||
// Update whitelist data when the video data is loaded
|
// Update whitelist data when the video data is loaded
|
||||||
whitelistCheck();
|
whitelistCheck();
|
||||||
|
|
||||||
// Temporary expirement
|
|
||||||
unlistedCheck();
|
|
||||||
|
|
||||||
//setup the preview bar
|
//setup the preview bar
|
||||||
if (previewBar === null) {
|
if (previewBar === null) {
|
||||||
if (onMobileYouTube) {
|
if (onMobileYouTube) {
|
||||||
@@ -878,66 +875,6 @@ async function whitelistCheck() {
|
|||||||
if (Config.config.forceChannelCheck && sponsorTimes?.length > 0) startSkipScheduleCheckingForStartSponsors();
|
if (Config.config.forceChannelCheck && sponsorTimes?.length > 0) startSkipScheduleCheckingForStartSponsors();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function unlistedCheck() {
|
|
||||||
if (!Config.config.allowExpirements || !Config.config.askAboutUnlistedVideos) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await utils.wait(() => !!videoInfo && !!document.getElementById("info-text")
|
|
||||||
&& !!document.querySelector(".ytd-video-primary-info-renderer > .badge > yt-icon > svg"), 6000, 1000);
|
|
||||||
|
|
||||||
const isUnlisted = document.querySelector(".ytd-video-primary-info-renderer > .badge > yt-icon > svg > g > path")
|
|
||||||
?.getAttribute("d")?.includes("M3.9 12c0-1.71 1.39-3.1 3.1-3.1h"); // Icon of unlisted badge
|
|
||||||
const yearMatches = document.querySelector("#info-text > #info-strings > yt-formatted-string")
|
|
||||||
?.innerHTML?.match(/20[0-9]{2}/);
|
|
||||||
const year = yearMatches ? parseInt(yearMatches[0]) : -1;
|
|
||||||
const isOld = !isNaN(year) && year < 2017 && year > 2004;
|
|
||||||
const views = parseInt(videoInfo?.videoDetails?.viewCount);
|
|
||||||
const isHighViews = views > 15000;
|
|
||||||
|
|
||||||
if (isUnlisted && isOld && isHighViews && (!sponsorTimes || sponsorTimes.length <= 0)) {
|
|
||||||
// Ask if they want to submit this videoID
|
|
||||||
const notice = new GenericNotice(skipNoticeContentContainer, "unlistedWarning", {
|
|
||||||
title: chrome.i18n.getMessage("experimentUnlistedTitle"),
|
|
||||||
textBoxes: chrome.i18n.getMessage("experimentUnlistedText").split("\n"),
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
name: chrome.i18n.getMessage("experiementOptOut"),
|
|
||||||
listener: () => {
|
|
||||||
Config.config.allowExpirements = false;
|
|
||||||
|
|
||||||
notice.close();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: chrome.i18n.getMessage("hideForever"),
|
|
||||||
listener: () => {
|
|
||||||
Config.config.askAboutUnlistedVideos = false;
|
|
||||||
|
|
||||||
notice.close();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Submit",
|
|
||||||
listener: () => {
|
|
||||||
utils.asyncRequestToServer("POST", "/api/unlistedVideo", {
|
|
||||||
videoID: sponsorVideoID,
|
|
||||||
year,
|
|
||||||
views,
|
|
||||||
channelID: channelIDInfo.status === ChannelIDStatus.Found ? channelIDInfo.id : undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
notice.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns info about the next upcoming sponsor skip
|
* Returns info about the next upcoming sponsor skip
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user