Get rid of unused YouTube subscriptions by identifying which channels you haven't watched in over a year.
YouTubeCleaner helps you clean up your YouTube subscriptions by identifying channels you are subscribed to but haven’t actually watched recently.
Due to changes in Google’s APIs, YouTube watch history is no longer accessible via the YouTube Data API. As a result, this tool combines:
- YouTube Data API v3 (to fetch current subscriptions), and
- Google Takeout watch-history export (to analyze actual viewing behavior)
This is now the only supported and reliable way to perform this analysis.
- Fetches all current YouTube channel subscriptions via API
- Analyzes actual watch history using Google Takeout JSON
- Identifies channels not watched in the past 365 days
- Interactive unsubscribe feature - choose which channels to unsubscribe from
- Generates detailed reports with channel names, IDs, and direct links
- Saves results to a timestamped text file for future reference
- Python 3.7 or higher
- A Google account with YouTube subscriptions
- A Google Cloud project with YouTube Data API v3 enabled
- A Google Takeout export containing YouTube watch history
-
Go to the Google Cloud Console
-
Create a new project or select an existing one
-
Enable the YouTube Data API v3:
- Navigate to APIs & Services → Library
- Search for YouTube Data API v3
- Click Enable
Google’s UI has changed. OAuth configuration is now split across multiple sections.
-
In Google Cloud Console, go to Google Auth Platform
-
Open Branding
- Set an app name
- Set user support email and developer contact email
-
Open Audience
- Choose External
- Add your own email address as a Test user
-
Go to Data Access
-
Click Add or Remove Scopes
-
Add the following scopes:
https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/youtube.force-sslNote:
youtubescope (notyoutube.readonly) is required for the unsubscribe feature. These scopes are classified by Google as Sensitive, not Restricted. No app verification is required as long as you remain in Testing.
Save changes.
-
Go to Clients
-
Click Create OAuth client
-
Set:
- Application type: Desktop app
- Name: YouTubeCleaner
-
Click Create
-
Download the JSON file
-
Rename it to
credentials.json -
Place it in the same directory as the script
Because YouTube no longer exposes watch history via API, you must use Google Takeout.
-
Click Deselect all
-
Select YouTube and YouTube Music
-
Click All YouTube data included
-
Deselect everything except:
- history → watch-history
-
Continue and create a one-time export
-
Download and unzip the archive
You should end up with a file at:
Takeout/
└── YouTube and YouTube Music/
└── history/
└── watch-history.json
Place watch-history.json where the script expects it (see script documentation or config).
pip install -r requirements.txtOr individually:
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib python-dateutil-
Ensure the following files are present:
credentials.jsonwatch-history.json
-
Run the script:
python youtube_subscription_analyzer.py-
On first run:
- A browser window will open
- Sign in with your Google account
- Grant the requested permissions
-
The script will:
- Fetch subscriptions via the YouTube Data API
- Analyze watch his
- Prompt you to optionally unsubscribe from unwatched channelstory from the Takeout export
- Generate a report
The script generates two outputs:
-
Console Output Summary of subscriptions and inactive channels
-
Text File Detailed report saved as:
youtube_subscription_analysis_YYYYMMDD_HHMMSS.txt
================================================================================
YOUTUBE SUBSCRIPTION ANALYSIS RESULTS
================================================================================
Total Subscriptions: 150
Watched in last year: 120
NOT watched in last year: 30
--------------------------------------------------------------------------------
CHANNELS NOT WATCHED IN OVER ONE YEAR:
--------------------------------------------------------------------------------
1. Example Channel Name
Channel ID: UCxxxxxxxxxxxxxxxxxx
Status: Last watched 2023-01-15
URL: https://www.youtube.com/channel/UCxxxxxxxxxxxxxxxxxx
- ❌ YouTube no longer provides watch history via API
- ❌ The Activities API does not expose reliable viewing data
- ✅ Google Takeout is now the only supported source for personal watch history
This tool reflects that reality.
credentials.json, OAuth tokens, and Takeout exports contain sensitive personal data- These filescan unsubscribe from channels (requires your explicit confirmation)
- Never commit or share them publicly
- The script is read-only and does not modify subscriptions
- YouTube Data API v3 free tier: 10,000 units/day
- Typical usage per run: 200–500 units
- Watch history analysis does not consume API quota
- Ensure Branding and Audience are fully configured
- Google hides OAuth client creation until those steps are complete
- Ensure the downloaded OAuth client file is renamed correctly
- Place it next to the script
- Confirm YouTube Data API v3 is enabled in the correct project
- Google Takeout reflects only what Google has retained
- Paused or deleted history will not appear
See LICENSE file for details.
Contributions are welcome.
If Google changes APIs (again), please open an issue so the tool can be updated accordingly.
