From ff44016003e0412cee3e6a77940ca5211a17749e Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Wed, 21 Jul 2021 11:48:19 -0400 Subject: [PATCH] Remove unlisted experiment --- public/_locales/en/messages.json | 6 --- src/config.ts | 6 ++- src/content.ts | 63 -------------------------------- 3 files changed, 4 insertions(+), 71 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index b501ed50..8a5a2b30 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -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." diff --git a/src/config.ts b/src/config.ts index 763eea72..6e7e4248 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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 { } function migrateOldFormats(config: SBConfig) { + if (config["askAboutUnlistedVideos"]) { + chrome.storage.sync.remove("askAboutUnlistedVideos"); + } + // Adding preview category if (!config["previewCategoryUpdate"]) { config["previewCategoryUpdate"] = true; diff --git a/src/content.ts b/src/content.ts index 96c41cab..b1db2c76 100644 --- a/src/content.ts +++ b/src/content.ts @@ -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 */