Tired of YouTube Music stopping mid-groove just because you're listening intently (or happen to be away from the keyboard)? 😫 This userscript keeps the tunes flowing by automatically handling those pesky "Are you still there?" checks! ✨
- ✅ Automatic AFK Prompt Bypass: Detects the "Are you still there?" / "Video paused. Continue watching?" modal and clicks "Yes" for you.
- 🔔 Warning Notification Handling: Catches the earlier "Still watching? Video will pause soon" notification and clicks "Yes" to prevent the main interruption.
- 💾 Persistent Logging: Records every bypass attempt (success/failure, timestamp) using your userscript manager's storage (
GM_setValue/GM_getValue). - 📄 CSV Log Export: Easily export the stored logs with a couple of clicks using the on-page button (
GM_download). - 📊 On-Page UI & Feedback:
- Adds a subtle floating
📊button (bottom-left) for log export access. - Displays clear, non-intrusive toast notifications (bottom-right) for script actions and status updates (✅ Success / ❌ Failure).
- Adds a subtle floating
- 🚀 Efficient Detection: Uses a
MutationObserverto watch for prompts without impacting browser performance.
-
🔧 Install a Userscript Manager: You need a browser extension to run userscripts. Popular choices:
- Tampermonkey (Chrome, Firefox, Edge, Safari, Opera)
- Greasemonkey (Firefox)
- Violentmonkey (Chrome, Firefox, Edge, Opera)
-
✅ Install the Script: Click the direct installation link below. Your userscript manager should pop up and ask for confirmation.
-
🎧 Verify: Open (or refresh) music.youtube.com. The script is active if you see the
📊button in the bottom-left corner.
- 🧘 Automatic: Just play your music on music.youtube.com! The script works silently in the background. When a prompt appears, it should be dismissed automatically within seconds, followed by a confirmation toast.
- 📊 Log Export:
- Click the floating
📊button (bottom-left). - A toast notification will appear showing the log count.
- If logs exist, click the
Export CSVbutton within the toast. - Your browser will prompt you to save the
.csvfile. 🎉
- Click the floating
- Initialization: When the YouTube Music page loads, the script sets up its components (toast system, stats button, observer).
- 👀 DOM Monitoring: A
MutationObserverwatches for changes in the page structure, specifically looking for elements related to AFK prompts (ytmusic-popup-container,tp-yt-paper-dialog,ytmusic-you-there-renderer, etc.) or visibility changes. - 🎯 Detection: When the observer signals a potential match, the script confirms if the actual AFK modal or warning notification elements are present and visible.
- 👆 Bypass Action: If found, it locates the confirmation button (usually "Yes") and programmatically clicks it.
- 📝 Logging & Feedback: The action's result is recorded using
GM_setValueand shown via a toast. It double-checks if the modal closed after the click, sometimes retrying if needed. - 📤 Export Mechanism: Clicking the export action retrieves logs via
GM_getValue, formats them as CSV, and usesGM_downloadto trigger the browser download.
Warning
Website Changes Can Break the Script: This script relies on YouTube Music's current HTML structure. Future website updates might change element IDs or classes, which could stop the script from working correctly.
Important
Log Storage Limits: Logs are saved using your userscript manager (GM_setValue). While userscripts managers generally apply for unlimitedStorage permission, we shouldn't rely on it. The data could be cleared by userscript removal, uninstalling extension, or other manual actions. Export logs periodically if you need a permanent record.