This bot automatically fetches the latest liked song from YouTube Music, downloads it, and sends it to a specified Telegram channel.
- Fetches the latest liked song from YouTube Music.
- Downloads the audio of the song from YouTube.
- Sends the downloaded song to a specified Telegram channel with its thumbnail and details.
- Python 3.6+
- A Telegram bot token (you can create one by talking to @BotFather)
- OAuth credentials for YouTube Music (follow the instructions here to set up OAuth)
-
Clone the repository
git clone https://github.com/MiliScripts/YTmusicloader.git cd YTmusicloader
-
Create and activate a virtual environment (optional but recommended)
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages
pip install -r requirements.txt
-
Set up OAuth for YouTube Music
Follow the instructions here to set up OAuth and download the
oauth.json
file to the project directory. -
Configure the Telegram bot
Open
bot.py
and update the following lines with your Telegram bot API details:mili_song_bot = Client( name='milisong', api_id=YOUR_API_ID, api_hash="YOUR_API_HASH", bot_token="YOUR_BOT_TOKEN" )
Run the bot using the following command:
python bot.py