Skip to content

Instantly share code, notes, and snippets.

@bxb100
Last active March 13, 2022 17:12
Show Gist options
  • Save bxb100/c7a50dbf048b1d62e6939feee6cbab1c to your computer and use it in GitHub Desktop.
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
@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
@bxb100
Copy link
Author

bxb100 commented Mar 13, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment