Created
March 14, 2023 04:25
-
-
Save HotoRas/03b589692ce0c5f2f5d56dffb494874f to your computer and use it in GitHub Desktop.
The yt-dlp launch script for Windows Powershell.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yt-dlp launcher | |
### Scripting trick: | |
### `"` is multiline! You can write multiline with just covering with `"`. | |
## Step 1. Set the batch path to where this `.ps1` is. | |
### TIP: This script is written assuming that it's placed with yt-dlp. | |
### You'd like to change the path part (`(Split-Path ~ .path)`) | |
### to where yt-dlp binary is. | |
### Example: | |
### If yt-dlp is C:\yt-dlp\yt-dlp.exe and the script is at %userprofile%\Downloads: | |
### cd C:\yt-dlp | |
cd (Split-Path ($MyInvocation.MyCommand).path) | |
## Step 2. Get URI and set as variable | |
### NOTE: You don't have to hardcode the URL. This script will get it when launched. | |
$uri = Read-Host -Prompt "Please paste the video URL you're about to download here" | |
## Step 3. Update yt-dlp | |
echo " | |
Updating yt-dlp... Please wait. | |
" | |
### Powershell doesn't trust the file at the same directory the console is pointing. | |
### With using .\ Powershell will trust the file since directory is defined, | |
### and in the end, launch it. | |
.\yt-dlp.exe -U | |
## Step 4. Run download | |
echo "yt-dlp is up-to-date: Now this'll download the video you've specified. | |
Downloading $uri... | |
" | |
### NOTE: | |
### 1. For some situations, the browser cookies are used to handle login features. | |
### yt-dlp will handle the login with ID/PASS, but handling with 2nd factor | |
### authentification is nearly impossible. | |
### So the browser cookie is used. | |
### 2. FFMPEG directory is set to `\ffmpeg\bin`. You can modify this. | |
### If you don't set, yt-dlp will try to launch FFMPEG | |
### as if it was at the same directory with FFMPEG. | |
### If the installation location is different, you should change it | |
### to where you've downloaded. | |
### 3. Browser profile is set to `Default`, the default profile for Chromium. | |
### If you're using different browser or profile, you should change it. | |
### Avaliable browsers are: brave, chrome, chromium, edge, firefox, opera, safari, vivaldi | |
#.\yt-dlp.exe $uri --cookies-from-browser chrome:Default #command when at ffmpeg bin dir | |
.\yt-dlp.exe $uri --ffmpeg-location="\ffmpeg\bin" --cookies-from-browser chrome:Default #command when ffmpeg at different dir | |
## Step 5. A quick pause to check the log | |
pause |
WARNING: THIS SCRIPT IS DEPRECATED AND NOW DOESN'T WORK ON LATEST WINDOWS 11
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before launch:
Programs required:
E:\Tools\yt-dlp\
. Placing around C:\ would work.)E:\ffmpeg\bin\
Placing around C:\ would work.).ps1
script file and double-click to open it with notepad.--ffmpeg-location="location"
or--cookies-from-browser BROWSER:PROFILE
to what matches to your environment.powershell PATH-TO-YOUR-PS1-FILE
(Example if the shell points to the directory the ps1 file (
launch.ps1
) exists:powershell .\launch.ps1
)