Continuing the legacy of Vanced
Script to import missing YouTube watch history
Warning
If you need help, you can visit our links at revanced.app or join our Discord.
Warning
This script automates your YouTube account, which is not in terms of YouTube's service. Use this script with caution.
To learn how to use the script and restore your history, follow the steps for your OS:
Windows
-
Install the latest Python from Microsoft Store or python.org.
-
Download the project and extract the ZIP somewhere
-
Open CMD in the directory where
main.py
is located -
install the required packages.
pip install -r requirements.txt
-
Go to Google Takeout.
-
Only tick "YouTube and YouTube Music"
-
Change "Multiple formats" to "JSON" (only for "history")
-
Untick everything in "All YouTube data included" except "history"
-
Click "Next step"
-
Leave everything as is and click "Create export"
After that, you will receive an email with a link to download your history. Download it. You will find a file called watch-history.json
in the downloaded zip file inside "YouTube and YouTube Music/history".
Place watch-history.json
in the same directory as main.py
.
Make sure you are logged into YouTube in your browser. By default, the script will use Chrome. If you use a different browser, use the --help
option when you run main.py
to select your browser.
Run the script:
⚠️ Warning
Make sure your browser does not run. Neither in the foreground nor in the background (See Task Manager), otherwise, you may get a permission error when running the script.
python main.py
ℹ️ Note
You can use the--help
option to see all available options.
Credits to @guillaumematheron for the original script.
"Restore missing YouTube watch history" is licensed under the GPLv3 license. Please see the license file for more information. tl;dr you may copy, distribute and modify "Restore missing YouTube watch history" as long as you track changes/dates in source files. Any modifications to "Restore missing YouTube watch history" must also be made available under the GPL, along with build & install instructions.