This project aims to automatically update YouTube Music playlists with the top 100 songs from the daily or weekly domestic Melon chart (멜론 일간차트 - 국내종합).
https://www.melon.com/chart/day/index.htm?classCd=DM0000
This project uses ytmusicapi: Unofficial API for YouTube Music.
- Install Python 3.
- Run
pip install -r requirements.txt
. - Create a "raw_headers.txt" in the root directory with the instructions found here.
- Create a "config.json" in the root directory with the following information:
{
"brand_account": "<optional brand account ID>",
"playlists": {
"daily": {
"url": "<playlist url>",
"playlist_id": "<playlist id>"
}
}
}
See the "examples/" folder for examples of how "raw_headers.txt" and "config.json" should look like.
- Run
cd src
to traverse into the "src" directory. - Run
python setup.py
. This should generate the "headers_auth.json" file in the root directory. - Run
python daily.py
orpython weekly.py
.
The playlist specified in the "config.json"'s playlist_id
should now be updated with the latest songs.
The code searches YouTube Music's song catalog using a song's title, artist, and album provided by Melon. While this usually returns the correct song, there is a chance that it does not so there is a chance this script does not work 100%. This is usually because of translation listing differences between the two platforms. For example, the Melon chart may have the song title as "헤픈 우연" but YouTube Music would list the song title as "HAPPEN (헤픈 우연)".
To mitigate such instances, the "data/manual_fixes.json" file has been added to account for problematic songs.