This PowerShell script automates the process of managing and syncing your "Watch Later" YouTube playlist by:
- Downloading videos from the playlist.
- Deleting locally stored videos if they are no longer in the playlist.
- Keeping track of downloaded videos to avoid re-downloading.
- Playlist Information Retrieval: Retrieves all video IDs in the "Watch Later" playlist.
- Local File Management: Compares downloaded videos against the playlist and deletes files not present in the playlist.
- New Video Downloading: Downloads new videos added to the playlist using
yt-dlp
. - Cookies Management: Uses cookies from the Vivaldi browser to handle YouTube authentication.
- PowerShell: Ensure you have PowerShell installed on your system.
- yt-dlp: Install
yt-dlp
for video downloading. Download yt-dlp - Browser: Ensure your youtube.com cookies are accessible from the browser.
- JSON Parsing: Ensure PowerShell has the
ConvertFrom-Json
cmdlet available.
- Clone this repository.
- Open PowerShell and navigate to the script’s directory.
- Modify the following variables in the script as needed:
$playlistUrl
: URL of the "Watch Later" playlist.$cookiesBrowser
: Browser to use for cookies (default:vivaldi
).$downloadFolder
: Directory to store downloaded videos.
- Open PowerShell and navigate to the script’s directory.
- Run the script by executing:
.\script.ps1
- The script will:
- Fetch the playlist information.
- Compare local files to the playlist.
- Delete videos not in the playlist.
- Download new videos from the playlist.
$playlistUrl
: The URL of your "Watch Later" playlist.$cookiesBrowser
: The browser to extract cookies from (default:vivaldi
).$downloadFolder
: Path to the folder where videos will be saved.$archiveFile
: File used to track downloaded videos.$videoFile
: Naming convention for downloaded videos.
- Ensure you have the necessary permissions to delete files in the specified
$downloadFolder
. - The script is configured to use
yt-dlp
and assumes it is installed and accessible in the system PATH. - Use this script responsibly and ensure compliance with YouTube’s terms of service.
- yt-dlp Command Not Found: Ensure
yt-dlp
is installed and added to your system PATH. - Permission Denied: Run PowerShell as an administrator if you encounter permission issues.
- Cookies Not Found: Verify that cookies are accessible from the specified browser.
Enjoy syncing your YouTube "Watch Later" playlist effortlessly!