|
@if (@a==@b) @end /* |
|
@echo off & setlocal enabledelayedexpansion |
|
title nava.downloader.bat @ https://gist.github.com/a-sync |
|
|
|
if "%~1"=="/?" goto usage |
|
if %0 == "%~0" ( |
|
set /p INPUT="nava.hu URL: " |
|
) else ( |
|
set "INPUT=%~1" |
|
) |
|
if "%INPUT%"=="" goto usage |
|
if /i "%INPUT:~0,5%"=="https" ( |
|
if /i "%INPUT:~6,13%"=="//nava.hu/id/" goto valid |
|
if /i "%INPUT:~6,16%"=="//nava.hu/embed/" goto valid |
|
) |
|
goto invalid |
|
|
|
:valid |
|
where /q yt-dlp |
|
if ERRORLEVEL 1 ( |
|
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe', '%~dp0\yt-dlp.exe')" |
|
) |
|
where /q ffmpeg |
|
if ERRORLEVEL 1 goto dlffmpeg |
|
where /q ffprobe |
|
if ERRORLEVEL 1 goto dlffmpeg |
|
goto main |
|
|
|
:dlffmpeg |
|
where /q 7za |
|
if ERRORLEVEL 1 ( |
|
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://a-sync.github.io/7z-extra/7za.exe', '%~dp0\7za.exe')" |
|
) |
|
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.7z', '%~dp0\ffmpeg-release-essentials.7z')" |
|
7za e -y -r ffmpeg-release-essentials.7z ffmpeg.exe ffprobe.exe |
|
del ffmpeg-release-essentials.7z 7za.exe 2>nul |
|
|
|
:main |
|
rem echo "%INPUT%" |
|
for /f "tokens=1-4 delims=|" %%I in ('cscript /nologo /e:jscript "%~f0" "%INPUT%"') do ( |
|
rem echo "%%I" |
|
rem echo "%%J" |
|
rem echo "%%K" |
|
rem echo "%%L" |
|
set URL=%%I |
|
set ID=%%J |
|
set TITLE=%%K |
|
set SUB=%%L |
|
|
|
:checkstatus |
|
if not "!STATUS!"=="" ( |
|
echo Statusz: !STATUS! |
|
timeout 12 |
|
) |
|
for /f "usebackq" %%A in (`powershell -Command "(Invoke-WebRequest -Uri 'https://nava.hu/wp-content/plugins/hms-nava/interface/getVideoRecall.php' -Method 'POST' -Body 'prefix=2&vid=!ID!' -UseBasicParsing).Content.Substring(1).Trim([char]34)"`) do ( |
|
set STATUS=%%A |
|
) |
|
rem echo "!STATUS!" |
|
if "!STATUS!"=="ON_DISK" goto ready |
|
if "!STATUS!"=="ON_CLOUD" goto ready |
|
if "!STATUS!"=="ON_TAPE" goto checkstatus |
|
if "!STATUS!"=="IN_QUEUE" goto checkstatus |
|
if "!STATUS!"=="IS_RECALLING" goto checkstatus |
|
if "!STATUS!"=="OVERLOAD" goto error |
|
if "!STATUS!"=="DB_ERROR" goto error |
|
if "!STATUS!"=="ARGS_ERROR" goto error |
|
|
|
:ready |
|
if "!URL:~-1!"=="=" ( |
|
for /f "usebackq" %%B in (`powershell -Command "(New-Object Net.WebClient).DownloadString('!URL!').Split([Environment]::NewLine,[StringSplitOptions]::RemoveEmptyEntries)[-1].Trim().Replace('_pd60000','_pd0')"`) do ( |
|
set TMPURL=%%B |
|
if /i not "!TMPURL:~0,5!"=="https" ( |
|
echo Varakozas a fajl listara... |
|
timeout 3 |
|
goto ready |
|
) |
|
set URL=%%B |
|
) |
|
) |
|
|
|
if not "!SUB!"=="" if not exist "!TITLE!.srt" ( |
|
powershell -Command "(New-Object Net.WebClient).DownloadFile('!SUB!', '%cd%\!ID!.srt')" |
|
ren "!ID!.srt" "!TITLE!.srt" |
|
) |
|
|
|
:try |
|
yt-dlp "!URL!" -o "!TITLE!.mp4" |
|
if not exist "!TITLE!.mp4" ( |
|
echo Varakozas a videora... |
|
timeout 30 |
|
goto try |
|
) |
|
) |
|
goto :EOF |
|
|
|
:invalid |
|
echo Ervenytelen URL |
|
echo |
|
:usage |
|
echo Hasznalat: %~nx0 URL |
|
echo pl.: %~nx0 https://nava.hu/id/* |
|
if %0 == "%~0" pause |
|
goto :EOF |
|
:error |
|
echo Szerver hiba tortent: !STATUS! |
|
if %0 == "%~0" pause |
|
goto :EOF |
|
|
|
JScript */ |
|
var INPUT = WSH.Arguments(0); |
|
var ID = INPUT.split('/')[4]; |
|
var SUB = ''; |
|
var TITLE = ''; |
|
var x = new ActiveXObject('Microsoft.XMLHTTP'); |
|
var UA = String('\x4D\x6F\x7A\x69\x6C\x6C\x61\x2F\x35\x2E\x30\x20\x28\x57\x69\x6E\x64\x6F\x77\x73\x20\x4E\x54\x20\x31\x30\x2E\x30\x3B\x20\x57\x69\x6E\x36\x34\x3B\x20\x78\x36\x34\x29\x20\x41\x70\x70\x6C\x65\x57\x65\x62\x4B\x69\x74\x2F\x35\x33\x37\x2E\x33\x36\x20\x28\x4B\x48\x54\x4D\x4C\x2C\x20\x6C\x69\x6B\x65\x20\x47\x65\x63\x6B\x6F\x29\x20\x43\x68\x72\x6F\x6D\x65\x2F\x38\x30\x2E\x30\x2E\x33\x39\x38\x37\x2E\x31\x34\x39\x20\x53\x61\x66\x61\x72\x69\x2F\x35\x33\x37\x2E\x33\x36'); |
|
|
|
x.open('GET',String(INPUT),true); |
|
x.setRequestHeader('User-Agent',UA); |
|
x.send(''); |
|
while (x.readyState!=4) {WSH.Sleep(50)}; |
|
|
|
if (x.responseText.indexOf('"tracks":[{"file":"') !== -1) { |
|
SUB = 'https:'+x.responseText.split('"tracks":[{"file":"')[1].split('"')[0].replace(/\\/g,''); |
|
} |
|
if (x.responseText.indexOf('<meta property="og:title" content="') !== -1) { |
|
TITLE = x.responseText.split('<meta property="og:title" content="')[1].split('"')[0]; |
|
} |
|
|
|
var htmlfile = WSH.CreateObject('htmlfile'), JSON; |
|
htmlfile.write('<meta http-equiv="x-ua-compatible" content="IE=9" />'); |
|
htmlfile.close(JSON = htmlfile.parentWindow.JSON); |
|
|
|
if (!TITLE){ |
|
x.open('GET',String('\x68\x74\x74\x70\x73\x3A\x2F\x2F\x6E\x61\x76\x61\x2E\x68\x75\x2F\x77\x70\x2D\x63\x6F\x6E\x74\x65\x6E\x74\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x68\x6D\x73\x2D\x6E\x61\x76\x61\x2F\x69\x6E\x74\x65\x72\x66\x61\x63\x65\x2F\x63\x6C\x61\x73\x73\x65\x73\x2F\x63\x61\x63\x68\x65\x4D\x61\x6E\x61\x67\x65\x72\x2E\x70\x68\x70\x3F\x73\x6F\x6C\x72\x55\x72\x6C\x3D\x26\x62\x6C\x6F\x67\x49\x64\x3D\x32\x26\x69\x64\x3D')+ID,true); |
|
x.setRequestHeader('User-Agent',UA); |
|
x.send(''); |
|
while (x.readyState!=4) {WSH.Sleep(50)}; |
|
|
|
var info = JSON.parse(x.responseText); |
|
TITLE = info.title; |
|
|
|
if (info.original && info.original.subtitle && info.original.subtitle.length) { |
|
var s = info.original.subtitle[0].split('(')[1].split(')')[0].replace(/\\/g,''); |
|
if (s) { |
|
SUB = 'https:'+String('\x2f\x2f\x6d\x65\x74\x61\x64\x61\x74\x61\x2e\x6e\x61\x76\x61\x2e\x68\x75\x2f\x73\x75\x62\x74\x69\x74\x6c\x65\x2f')+s; |
|
} |
|
} |
|
} |
|
TITLE = TITLE.replace(/\\|\/|\:|\*|\?|\"|\<|\>|\|/gi, '_'); |
|
if (!TITLE) TITLE = ID; |
|
|
|
x.open('GET',String('\x68\x74\x74\x70\x73\x3A\x2F\x2F\x6E\x61\x76\x61\x2E\x68\x75\x2F\x77\x70\x2D\x63\x6F\x6E\x74\x65\x6E\x74\x2F\x70\x6C\x75\x67\x69\x6E\x73\x2F\x68\x6D\x73\x2D\x6E\x61\x76\x61\x2F\x69\x6E\x74\x65\x72\x66\x61\x63\x65\x2F\x67\x65\x74\x50\x6C\x61\x79\x65\x72\x54\x6F\x6B\x65\x6E\x2E\x70\x68\x70\x3F\x70\x72\x65\x66\x69\x78\x3D\x32\x26\x76\x69\x64\x3D')+ID,true); |
|
x.setRequestHeader('User-Agent',UA); |
|
x.send(''); |
|
while (x.readyState!=4) {WSH.Sleep(50)}; |
|
|
|
var res = JSON.parse(x.responseText); |
|
WSH.Echo(String('\x68\x74\x74\x70\x73\x3a\x2f\x2f\x73\x74\x72\x6c\x62\x2e\x6e\x61\x76\x61\x2e\x68\x75\x2f\x6c\x62\x73\x2f\x6e\x61\x76\x61\x68\x75\x5f\x62\x64\x72\x6d\x2f\x5f\x64\x65\x66\x69\x6e\x73\x74\x5f\x2f\x61\x6d\x6c\x73\x74\x3a')+res.vid+String('\x3F\x74\x79\x70\x65\x3D\x6D\x33\x75\x38\x26\x73\x65\x73\x73\x69\x64\x3D')+res.token+'|'+ID+'|'+TITLE+'|'+SUB); |
sajnos ez már nem használható, mert a nava mindenre DRM protectiont rakott