Added license and readme

This commit is contained in:
0% [█ █ █ █ █ █ █ █ █ █] 100%
2026-07-09 15:34:04 -05:00
parent c1b3f399f3
commit d044dbf205
2 changed files with 65 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
MIT License
Copyright (c) 2026 mastercodeon
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
+47
View File
@@ -0,0 +1,47 @@
# YouTube Music Auto-Confirm & Anti-Pause
A lightweight, highly effective Tampermonkey userscript that ensures uninterrupted listening on YouTube Music. It automatically dismisses "Are you still there?" prompts, auto-accepts viewer discretion warnings, and spoofs user activity to prevent playback from pausing in the background.
## ✨ Features
* **Anti-Pause Activity Spoofing**: Silently spoofs user activity (simulating keypresses and updating internal trackers) every minute to prevent YouTube's inactivity timer from triggering.
* **Auto-Dismiss "Are you still there?"**: If the inactivity popup does manage to appear, the script instantly detects it, clicks "Yes", and resumes playback.
* **Auto-Accept Discretion Warnings**: Automatically clicks "I understand and wish to proceed" on content warnings (e.g., suicide/self-harm topics) and resumes the video/song.
* **Native UI Integration**: Injects a sleek, non-intrusive status badge into the top-right YouTube Music navigation bar. It features a pulsing green dot and tracks how many times activity has been spoofed.
* **Smart Loop Prevention**: Includes a 3-second action cooldown and promise-based error handling to prevent infinite play/pause loops caused by strict browser autoplay policies.
## 🚀 Installation
1. **Install a Userscript Manager**:
* [Tampermonkey](https://www.tampermonkey.net/) (Recommended)
* [Violentmonkey](https://violentmonkey.github.io/)
* [Greasemonkey](https://www.greasespot.net/)
2. **Install the Script**:
* **Option A (Direct Install)**: Click on the `YouTube_Music_Auto_Confirm_-Are_You_Still_There-_&_Discretion_Warning-1.9.user.js` file in this repository, click the **Raw** button, and your userscript manager should prompt you to install it.
* **Option B (Manual)**: Open your userscript manager dashboard, click "Create a new script", copy the entire contents of the `.user.js` file from this repository, paste it into the editor, and save (Ctrl+S / Cmd+S).
3. **Refresh YouTube Music**: Reload any open `music.youtube.com` tabs for the script to take effect.
## 💻 Usage
Once installed, the script runs completely in the background. You don't need to configure anything.
To verify it is working:
1. Open [YouTube Music](https://music.youtube.com).
2. Look at the top right corner of the navigation bar (next to your profile picture/cast icon).
3. You should see a subtle **Anti-Pause: 0** badge with a pulsing dot. The number will increase every minute as the script spoofs activity to keep your session alive.
## 🛠️ How It Works (Technical Details)
* **Activity Spoofing**: YouTube tracks inactivity via the `window._lact` variable. The script updates this timestamp to `Date.now()` and dispatches a harmless `Shift` keyup event every 60 seconds.
* **DOM Monitoring**: The script polls the DOM every 2 seconds (and listens for HTML5 `<video>` `pause` events) to check for the presence of `ytmusic-you-there-renderer` or `#player-error-message-container`.
* **Visibility Checks**: It uses `.offsetParent !== null` to ensure it only interacts with popups that are actually visible on the screen, avoiding false positives from hidden DOM elements.
* **Autoplay Handling**: Browsers often block scripts from calling `video.play()` if the user hasn't interacted with the page recently. The script catches `DOMException` autoplay rejections gracefully to prevent console spam and infinite loops.
## ⚠️ Troubleshooting
* **The video stays paused after a warning**: If you open a link in a new background tab and a discretion warning appears, the script will click "Proceed", but your browser's Autoplay Policy might block the video from resuming until you physically click anywhere on the page. This is a browser security feature, not a bug in the script.
* **Badge isn't showing**: The script waits for the YouTube Music navigation bar to load. If you have a slow connection, it might take a few extra seconds for the "Anti-Pause" badge to appear.
## 📄 License
This project is open-source and available under the MIT License. Feel free to fork, modify, and improve it!