mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Remove unlisted experiment
This commit is contained in:
parent
caae61a6a8
commit
ff44016003
3 changed files with 4 additions and 71 deletions
|
@ -669,12 +669,6 @@
|
|||
"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": {
|
||||
"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."
|
||||
|
|
|
@ -39,7 +39,6 @@ interface SBConfig {
|
|||
testingServer: boolean,
|
||||
refetchWhenNotFound: boolean,
|
||||
ytInfoPermissionGranted: boolean,
|
||||
askAboutUnlistedVideos: boolean,
|
||||
allowExpirements: boolean,
|
||||
autoHideInfoButton: boolean,
|
||||
|
||||
|
@ -179,7 +178,6 @@ const Config: SBObject = {
|
|||
testingServer: false,
|
||||
refetchWhenNotFound: true,
|
||||
ytInfoPermissionGranted: false,
|
||||
askAboutUnlistedVideos: true,
|
||||
allowExpirements: true,
|
||||
autoHideInfoButton: true,
|
||||
|
||||
|
@ -345,6 +343,10 @@ function fetchConfig(): Promise<void> {
|
|||
}
|
||||
|
||||
function migrateOldFormats(config: SBConfig) {
|
||||
if (config["askAboutUnlistedVideos"]) {
|
||||
chrome.storage.sync.remove("askAboutUnlistedVideos");
|
||||
}
|
||||
|
||||
// Adding preview category
|
||||
if (!config["previewCategoryUpdate"]) {
|
||||
config["previewCategoryUpdate"] = true;
|
||||
|
|
|
@ -282,9 +282,6 @@ async function videoIDChange(id) {
|
|||
// Update whitelist data when the video data is loaded
|
||||
whitelistCheck();
|
||||
|
||||
// Temporary expirement
|
||||
unlistedCheck();
|
||||
|
||||
//setup the preview bar
|
||||
if (previewBar === null) {
|
||||
if (onMobileYouTube) {
|
||||
|
@ -878,66 +875,6 @@ async function whitelistCheck() {
|
|||
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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue