วิธีเลิกติดตาม Unsubscribe ช่อง YouTube ทั้งหมด ในสคริปเดียว

ไปอ่านเจอคำถามว่า ต้องการยกเลิกการติดตาม Unsubscribe ช่อง YouTube ทั้งหมด โดยไม่ต้องคลิกยกเลิกเองทีละช่อง ทำได้หรือไม่?

ก็เลยไปลองค้นหาใน Google ปรากฎว่า มีคนเขียนสคริปเอาไว้ เพียงแค่เปิดโหมด Inspect แล้วเข้าเมนู Console เอาสคริปดังกล่าวไปวาง แล้วกด Enter จากนั้นระบบก็จะทำงานทะยอยยกเลิกการติดตามให้ทั้งหมด

ทั้งนี้ กระบวนการนี้ ต้องใช้ Google Chrome และเปิดในคอมพิวเตอร์เท่านั้น ในมือถือหรือแท็ปเล็ตทำไม่ได้

1. เปิดเว็บ YouTube แล้วเข้าไปที่เมนู Subscriptions > Manage

2. คลิกขวาตรงพื้นที่ว่าง เลือกเมนู Inspect เปิดแถบ Console

3. คัดลอก สคริปไปวางต่อท้าย ตรงบรรทัด ที่มีเครื่องหมาย >

ในรอบแรก เบราว์เซอร์ Google Chrome จะเตือนว่าอาจมีความเสี่ยงที่ไม่ปลอดภัย แต่ถ้าต้องการดำเนินการต่อ ให้พิมพ์ allow pasting (ยอมให้วาง) แล้วคัดลอก สคริปมาวางอีกครั้ง

/**
* YouTube bulk unsubscribe fn.
* Wrapping this in an IIFE for browser compatibility.
*/
(async function iife() {
// This is the time delay after which the "unsubscribe" button is "clicked"; Change it as per your need!
var UNSUBSCRIBE_DELAY_TIME = 2000
/**
* Delay runner. Wraps `setTimeout` so it can be `await`ed on.
* @param {Function} fn
* @param {number} delay
*/
var runAfterDelay = (fn, delay) => new Promise((resolve, reject) => {
setTimeout(() => {
fn()
resolve()
}, delay)
})
// Get the channel list; this can be considered a row in the page.
var channels = Array.from(document.getElementsByTagName(`ytd-channel-renderer`))
console.log(`${channels.length} channels found.`)
var ctr = 0
for (const channel of channels) {
// Get the subscribe button and trigger a "click"
channel.querySelector(`[aria-label^='Unsubscribe from']`).click()
await runAfterDelay(() => {
// Get the dialog container...
document.getElementsByTagName(`yt-confirm-dialog-renderer`)[0]
// and find the confirm button...
.querySelector(`[aria-label^='Unsubscribe']`).click()
console.log(`Unsubsribed ${ctr + 1}/${channels.length}`)
ctr++
}, UNSUBSCRIBE_DELAY_TIME)
}
})()

4. นั่งรอระบบทำงาน

ในจุดนี้ ระยะเวลาในการรอให้ระบบทำงาน ขึ้นอยู่กับจำนวนช่อง YouTube ที่เคยกดติดตามเอาไว้

Credit รายละเอียดเพิ่มเติม:

  1. How to Unsubscribe From All YouTube Channels in One Go
  2. How to unsubscribe from all the Youtube channels at once? [closed]