youtube-watch-history-to-csv
youtube-watch-history-to-csv copied to clipboard
This project allows you to convert your YouTube watch history HTML file from Google Takeout into a CSV file that can be used by the universalscrobbler.com to Scrobble manually in bulk.
youtube-watch-history-to-csv
This project allows you to convert your YouTube watch history HTML file from Google Takeout into a CSV file that can be used by the universalscrobbler.com to Scrobble manually in bulk.
Getting your YouTube Watch History
Follow these steps to download your YouTube watch history from Google Takeout:
- Go to Google Takeout.
- Click
Create new export
. - Click
Deselect all
. - Scroll down and find YouTube, then check mark it.
- Click
All YouTube data included
. - Click
Deselect all
. - Only select
History
. - Click
Ok
. - Click
Next step
. - Select
Send the download link via email
. - Select
Export once
. - For file type, choose
.zip
. - Choose the maximum size of 1GB (the history file is less than 100MB).
- Click
Create export
.
You will receive a .zip
file named takeout-xxxxx-xxx.zip
in your email. Extract the file named watch-history.html
located in the Takeout/Youtube and YouTube Music/history/
directory from the zip file.
Formatting the HTML File
To make the script work faster, use tidy
to fix the formatting of the HTML file. Install tidy using:
For apt:
sudo apt install tidy
For brew:
brew install tidy-html5
Then, type this in your terminal:
tidy -indent --indent-spaces 2 -quiet --tidy-mark no watch-history.html > tidy-watch-history.html
Script Setup
This script requires Python 3.7 or higher. Run the setup.sh
to create the environment. After it is done, activate it using this command:
source yt-history-env/bin/activate
Then run the script like this:
python yt-history-to-csv.py tidy-watch-history.html yt-history.csv
To stop the script, press ctrl+c
. To continue the script, run the script again. It will fetch the last progress and continue from that point.
This will convert your YouTube watch history into a CSV file that can be used by the universalscrobbler.com to Scrobble manually in bulk.