@echo off
title KSV Adobe HDS Downloader/Viewer
del *.txt 2>nul
dip\MozillaCacheView /sxml tmp.txt >nul
type tmp.txt | find ".f4m" | dip\cut -d">" -f2 | dip\cut -d"<" -f1 >manifestURL.txt
type tmp.txt | find "Seg1" | dip\cut -d">" -f2 | dip\cut -d"<" -f1 | dip\cut -d"?" -f2 >auth.txt
del tmp.txt >nul
if exist dip\ua.ini goto INIZIO
:UA
cls
echo.
set /p "ua=PASTE YOUR Firefox USER AGENT: "
if "%ua%"=="" goto UA
if "%ua%"==" " goto UA
echo %ua%>dip\ua.ini
:INIZIO
set "force="
set "par="
set "para="
set "qua="
set "pro="
set "proxy="
set "manifest="
set "aut="
set "auth="
set "durx="
set "durxx="
set "star="
set "startx="
set "debug="
set "plll="
set "pll="
set "au="
set /p ua=<dip\ua.ini
cls
echo.
set /p "manifest=PASTE MANIFEST: "
if "%manifest%"=="" goto INIZIO
if "%manifest%"==" " goto INIZIO
:AUTH
cls
echo.
set /p "aut=Do you want use authentication string? (y/n) "
if "%aut%"=="y" goto AUT
if "%aut%"=="Y" goto AUT
if "%aut%"=="n" goto QUA
if "%aut%"=="N" goto QUA
goto AUTH
:QUA
cls
echo.
set /p "qua=CHOOSE QUALITY (1=LOW 2=MEDIUM 3=HIGH) : "
if "%qua%"=="1" set "qua=low" & goto PARA
if "%qua%"=="2" set "qua=medium" & goto PARA
if "%qua%"=="3" set "qua=high" & goto PARA
goto QUA
:PARA
cls
echo.
set /p "para=Do you want change the number of fragments to download simultaneously (now are 8!)? (y/n) "
if "%para%"=="y" goto PAR
if "%para%"=="Y" goto PAR
if "%para%"=="n" goto PRO
if "%para%"=="N" goto PRO
goto PARA
:PRO
cls
echo.
set /p "pro=Do you want use a proxy? (y/n) "
if "%pro%"=="y" goto INP
if "%pro%"=="Y" goto INP
if "%pro%"=="n" goto STAR
if "%pro%"=="N" goto STAR
goto PRO
:STAR
cls
echo.
set /p "star=Do you want to set the start fragment? (y/n): "
if "%star%"=="y" goto STARTX
if "%star%"=="Y" goto STARTX
if "%star%"=="n" goto DURX
if "%star%"=="N" goto DURX
goto STAR
:DURX
cls
echo.
set /p "durx=Do you want to set a duration for recording? (y/n): "
if "%durx%"=="y" goto DURXX
if "%durx%"=="Y" goto DURXX
if "%durx%"=="n" goto DEBUG
if "%durx%"=="N" goto DEBUG
goto DURX
:DEBUG
cls
echo.
set /p "debug=Do you want to view debug information? (y/n): "
if "%debug%"=="y" set "debug=--debug" & goto MANI
if "%debug%"=="Y" set "debug=--debug" & goto MANI
if "%debug%"=="n" set "debug=" & goto MANI
if "%debug%"=="N" set "debug=" & goto MANI
goto DEBUG
:MANI
cls
echo.
set /p "pll=Do you want view on Mplayer2? (y/n) "
if "%pll%"=="y" set /p plll=<dip\play.txt & goto MANI2
if "%pll%"=="Y" set /p plll=<dip\play.txt & goto MANI2
if "%pll%"=="n" set "plll=" & goto MANI2
if "%pll%"=="N" set "plll=" & goto MANI2
goto MANI
:MANI2
cls
dip\php\php dip\adobehds.php %debug% %force% --delete --rename --useragent "%ua%" --manifest "%manifest%" --quality "%qua%" %proxy% %au%"%auth%" %par% %durxx% %startx% %plll%
pause
del *.txt >nul
goto:eof
:INP
cls
echo.
set /p "proxy=INSERT PROXY: (proxy:port) "
if "%proxy%"=="" goto INP
if "%proxy%"==" " goto INP
set "proxy=--proxy "%proxy%""
:INP2
cls
echo.
set /p "force=Do you want to force the proxy for downloading of fragments? (y/n) "
if "%force%"=="y" set "force=--fproxy" & goto DURX
if "%force%"=="Y" set "force=--fproxy" & goto DURX
if "%force%"=="n" set "force=" & goto DURX
if "%force%"=="N" set "force=" & goto DURX
goto INP2
:AUT
cls
echo.
set /p "auth=PASTE AUTH. STRING: "
if "%auth%"=="" goto AUT
if "%auth%"==" " goto AUT
set "au=--auth "
goto QUA
:PAR
cls
echo.
set /p "par=CHOOSE THE NUMBER OF FRAGMENTS TO DOWNLOAD SIMULTANEOUSLY: (1/8) "
if %par% gtr 8 goto PAR
if %par% lss 1 goto PAR
if "%par%"=="" goto PAR
if "%par%"==" " goto PAR
set "par=--parallel "%par%""
goto PRO
:DURXX
cls
echo.
set /p "durxx=INSERT NUMBER OF SECONDS: "
if "%durxx%"=="" goto DURXX
if "%durxx%"==" " goto DURXX
set "durxx=--duration "%durxx%""
goto DEBUG
:STARTX
cls
echo.
set /p "startx=INSERT NUMBER OF FRAGMENT START: "
if "%startx%"=="" goto STARTX
if "%startx%"==" " goto STARTX
set "startx=--start "%startx%""
goto DURX