A Python tool to migrate your YouTube Music data (liked songs, playlists) between different accounts.
- Python 3.7 or higher
- pip (Python package installer)
- A Google Cloud Project with YouTube Data API v3 enabled (for OAuth authentication)
- Clone the repository:
git clone https://github.com/raedkit/YTMigrate.git
cd YTMigrate- Create and activate a virtual environment:
# On macOS/Linux
python3 -m venv venv
source venv/bin/activate
# On Windows
python -m venv venv
.\venv\Scripts\activate- Install dependencies:
pip install -r requirements.txtYTMigrate supports two authentication methods:
-
Set up OAuth credentials:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the YouTube Data API v3
- Go to Credentials -> Create Credentials -> OAuth Client ID
- Choose "Desktop Application" as application type
- Download the client secrets file and save it as
client_secrets.jsonin the project directory
-
Set up authentication for both accounts:
# For source account
python setup_oauth.py client_secrets.json source_oauth.json
# For destination account
python setup_oauth.py client_secrets.json dest_oauth.jsonIf OAuth setup is not possible, you can use browser headers:
- Set up authentication for both accounts:
# For source account
python setup_headers.py source_headers.json
# For destination account
python setup_headers.py dest_headers.json- Follow the instructions to copy headers from your browser:
- Open YouTube Music in your browser
- Open Developer Tools (F12)
- Go to Network tab
- Click on any request to music.youtube.com
- Right-click -> Copy -> Copy request headers
- Paste when prompted (on macOS, headers will be automatically read from clipboard)
After setting up authentication, run the main script:
python main.pyThe script will:
- Authenticate with both accounts
- Load liked songs from the source account
- Copy any songs that aren't already liked in the destination account
- Make sure the YouTube Data API v3 is enabled in your Google Cloud Project
- Verify that your OAuth consent screen is properly configured
- Check that you're using the correct Google accounts when authorizing
- Ensure you're copying the full headers from a recent request
- Try logging out and back in to YouTube Music before copying headers
- Make sure you're using different browsers/incognito mode for each account
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.