This script allows you to submit your YouTube Music watch history to Listenbrainz.
- Python 3.x installed on your computer.
- An active Listenbrainz account.
- Your YouTube Music watch history file from Google Takeout.
- Visit Google Takeout.
- From the list of data to include, deselect all except for YouTube and YouTube Music.
- Within the YouTube and YouTube Music section, select only history and then watch history.
- Click Next step and follow the prompts to download your watch history, which will be provided as a
watch-history.jsonfile.
- Download
YTMusic2listenbrainz.pyscript from this repository. - Place your
watch-history.jsonfile in the same directory as theYTMusic2listenbrainz.pyscript. - Enter your
listenbrainz_tokeninYTMusic2listenbrainz.py.
Open a terminal or command prompt and navigate to the directory containing the script and your watch history file. Run the script with the following command:
python3 YTMusic2listenbrainz.pyAfter running the script, log in to your Listenbrainz account to verify that your watch history has been submitted successfully.
The JSON file often leads to incomplete or truncated listening histories. Conversely, the HTML file contains a complete history of listening data. There is another file called
MyActivity.htmlthat seems to contain the same data including YouTube watch history that could also be used as source data. It doesn't seem to have the same truncation issues.I'm not sure what to do with this information to other than to alert developers.