Last active
March 13, 2022 17:12
-
-
Save bxb100/c7a50dbf048b1d62e6939feee6cbab1c to your computer and use it in GitHub Desktop.
Parse html page gets m3u8 link then using N_m3u8DL-CLI to download video
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
@echo off | |
setlocal EnableDelayedExpansion | |
echo ================[ Getting web page ]================ | |
set URL=%1 | |
if NOT "%URL:~-1%" == "/" ( | |
set URL="%URL%/" | |
) | |
echo 'url: %URL%' | |
for /f "tokens=4 delims=/" %%a in ("%URL%") do ( | |
set saveName=%%a | |
) | |
echo 'filename: %saveName%' | |
@Powershell.exe -command "Invoke-WebRequest -Uri %URL% -OutFile tmp.html" | |
echo ================[ Find m3u8 link ]================ | |
for /f "eol=; tokens=2 delims='" %%i in ('findstr "m3u8" "tmp.html"') do ( | |
set m3u8=%%i | |
) | |
echo 'm3u8 path: %m3u8%' | |
echo ================[ Call the N_m3u8DL-CLI ]================ | |
@call N_m3u8DL-CLI "%m3u8%" --workDir "." --saveName "%saveName%" --enableDelAfterDone | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/nilaoda/N_m3u8DL-CLI
It will throw error