@echo off chcp 65001 >nul setlocal enabledelayedexpansion echo ================================ echo GronkhTV Downloader echo ================================ echo. :: URL-Eingabe set /p URL="Gib die GronkhTV URL ein (z.B. https://gronkh.tv/streams/1046): " if "%URL%"=="" ( echo Fehler: Keine URL eingegeben! pause exit /b 1 ) echo. echo Verarbeite URL... :: Episode-ID extrahieren mit PowerShell for /f "delims=" %%i in ('powershell -NoProfile -Command "if ('%URL%' -match '/streams/(\d+)') { $matches[1] } else { 'ERROR' }"') do set EPISODE_ID=%%i if "%EPISODE_ID%"=="ERROR" ( echo Fehler: Ungueltige URL! Muss Format https://gronkh.tv/streams/NUMMER haben pause exit /b 1 ) echo Episode-ID: %EPISODE_ID% echo. :: playlist_url von API holen echo Hole Playlist-URL... for /f "delims=" %%i in ('powershell -NoProfile -Command "try { (Invoke-RestMethod -Uri 'https://api.gronkh.tv/v1/video/playlist?episode=%EPISODE_ID%').playlist_url } catch { 'ERROR' }"') do set PLAYLIST_URL=%%i if "%PLAYLIST_URL%"=="ERROR" ( echo Fehler: Konnte Playlist-URL nicht abrufen! pause exit /b 1 ) echo Playlist-URL: %PLAYLIST_URL% echo. :: Qualitaetsstufen aus m3u8 extrahieren echo Analysiere verfuegbare Qualitaeten... :: M3U8 mit curl herunterladen curl -s -H "Referer: https://gronkh.tv" "%PLAYLIST_URL%" > playlist.m3u8 :: URLs extrahieren (alle https URLs) set STREAM_NUM=0 for /f "usebackq delims=" %%a in (`findstr /B "https" playlist.m3u8`) do ( set /a STREAM_NUM+=1 if !STREAM_NUM!==1 set "STREAM_URL_1=%%a" if !STREAM_NUM!==2 set "STREAM_URL_2=%%a" if !STREAM_NUM!==3 set "STREAM_URL_3=%%a" ) :: Qualitaetslabels setzen set QUALITY_1=1080p60 set QUALITY_2=720p set QUALITY_3=360p del playlist.m3u8 echo. echo Verfuegbare Qualitaeten: if not "%STREAM_URL_1%"=="" echo 1. %QUALITY_1% if not "%STREAM_URL_2%"=="" echo 2. %QUALITY_2% if not "%STREAM_URL_3%"=="" echo 3. %QUALITY_3% echo. choice /c 123 /n /m "Waehle Qualitaet (1-3): " set SELECTED_QUALITY=%errorlevel% if "%SELECTED_QUALITY%"=="1" ( set FINAL_STREAM_URL=%STREAM_URL_1% set QUALITY_NAME=%QUALITY_1% ) if "%SELECTED_QUALITY%"=="2" ( set FINAL_STREAM_URL=%STREAM_URL_2% set QUALITY_NAME=%QUALITY_2% ) if "%SELECTED_QUALITY%"=="3" ( set FINAL_STREAM_URL=%STREAM_URL_3% set QUALITY_NAME=%QUALITY_3% ) echo Ausgewaehlte Qualitaet: %QUALITY_NAME% echo. :: Video-Titel von API holen und bereinigen echo Hole Video-Titel... for /f "delims=" %%i in ('powershell -NoProfile -Command "$title = try { (Invoke-RestMethod -Uri 'https://api.gronkh.tv/v1/video/info?episode=%EPISODE_ID%').title } catch { 'GTV%EPISODE_ID%' }; $clean = $title -replace '[^\w\s\-,]', '' -replace '\s+', '_' -replace '_+', '_' -replace '^_|_$', ''; if ($clean.Length -gt 200) { $clean = $clean.Substring(0, 200) }; $clean"') do set VIDEO_TITLE=%%i if "%VIDEO_TITLE%"=="" set VIDEO_TITLE=GTV%EPISODE_ID% echo Titel: %VIDEO_TITLE% echo Dateiname: %VIDEO_TITLE%.mkv echo. :: ffmpeg pruefen where ffmpeg >nul 2>nul if %errorlevel% neq 0 ( echo Fehler: ffmpeg ist nicht installiert oder nicht in PATH! echo Bitte ffmpeg installieren: https://ffmpeg.org/download.html pause exit /b 1 ) :: Download mit ffmpeg echo ================================ echo Starte Download... (Abbrechen mit STRG+C) echo ================================ echo. ffmpeg -loglevel error -stats -headers "Referer: https://gronkh.tv/" -i "%FINAL_STREAM_URL%" -c copy -bsf:a aac_adtstoasc "%VIDEO_TITLE%.mkv" if %errorlevel% equ 0 ( echo. echo ================================ echo Download erfolgreich! echo Gespeichert als: %VIDEO_TITLE%.mkv echo ================================ ) else ( echo. echo ================================ echo Fehler beim Download! echo ================================ ) echo. pause