This is an analytics script written in Python that parses the data output provided by Google. Currently the functionality is limited to calculating total time in seconds spent on YouTube.
The Youtube Video API can be found here
- Go to Google Takeout
- Scroll down to section that reads "YouTube and YouTube Music"
- Click on "All YouTube data included"
- Click on "Deselect all"
- Select "history" and "subscriptions" and click "OK"
- Click on "Multiple formats"
- Change the output format for "history" to
JSON
and click "OK" - Click on "Next step"
- Select your preferred method of delivery. Google may take some time to export it.
- Once it's ready, copy the
watch-history.json
file in the downloaded folder to the cloned git repository - Run
python3 history.py
. The script will ask you for some inputs. - Enter your Google Cloud API Key. Learn how to get one here.
- Enter the name of the video-history file (By default, this is called
watch-history.json
. - Enter the name of the output file to cache the results
- Hooray! You have successfully the script. Hopefully you haven't wasted too much time on YouTube! :-)