YouTube Music Auto-Like

kb5000
2023-06-02T14:23:44Z

The YouTube Music Auto-Like is a Tampermonkey script that enhances your YouTube Music experience by enabling automatic liking of the currently playing song through a specific key press, even when the YouTube Music page is running in the background. The script works in tandem with a concurrently running Python script for seamless operation. Ensure both scripts are active for the best experience.

The YouTube Music Auto-Like is a script designed to enhance your YouTube Music experience. The primary function of this script is to help users automatically "like" (add to their library) any song currently playing on YouTube Music when a specific key is pressed, even if the YouTube Music webpage is running in the background.

The script relies on an accompanying Python script, which needs to be running simultaneously for the script to function. This combination allows for an even more tailored music listening experience, bridging the gap between your browser and your personal key preferences.

Features:

Auto-Like: With a press of a designated key, you can instantly "like" the currently playing song on YouTube Music, adding it to your library for future enjoyment.

Background Capability: The script functions even when the YouTube Music page is not in focus, enabling you to continue your work or browsing without needing to switch tabs.

Python Script Integration: The script works hand in hand with a Python script, running simultaneously to ensure seamless and efficient operation.

Note: The Python script must be running in parallel for the script to function correctly. Please make sure you have both the Tampermonkey script and Python script installed and running for the best experience.

This Tampermonkey script is a powerful tool for enhancing your music discovery and collection on YouTube Music, providing you with the convenience of automatically liking songs with the simple press of a key. Whether you're working, browsing, or simply enjoying your favorite tracks, the YouTube Music Auto-Like script takes your music listening experience to the next level.

Here is the full code of the Python Script.

import keyboard
from aiohttp import web
import json

to_process_like = False

def handle_up_key():
    global to_process_like
    to_process_like = True

async def start_server(request):
    global to_process_like
    last_state = to_process_like
    to_process_like = False
    return web.Response(text=json.dumps(last_state))

app = web.Application()
app.add_routes([web.get('/', start_server)])

if __name__ == '__main__':
    # Note: change here to use any key you want
    keyboard.add_hotkey('f2', handle_up_key)
    web.run_app(app, port=15065)

To run the Python code, you have to install Python first. And install these dependencies:

pip install keyboard aiohttp