Skip to content

Commit

Permalink
New workaround for Arte single stream
Browse files Browse the repository at this point in the history
  • Loading branch information
PCigales authored Nov 13, 2024
1 parent 9805630 commit a79f7af
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions youtube-dl.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@set "youtube-dl_path="C:\Program Files\yt-dlp\yt-dlp.exe""
@set "youtube-dl_path="C:\Program Files\SMPlayer\mpv\youtube-dl.exe""

@echo off>nul
setlocal enabledelayedexpansion
Expand Down Expand Up @@ -35,26 +35,48 @@ goto end
:arte

if "%1" == "nomux" (
for /F "delims=/ tokens=3,5,6" %%a in ("!mediabuilder_url!") do (set "youtube-dl_lng=%%a" & set "youtube-dl_url=https://api.arte.tv/api/opa/v3/videoStreams?channel=FR&protocol=HTTPS&quality=SQ&kind=SHOW&limit=100&programId=%%b" & echo.%%c)
if /I "!youtube-dl_lng!"=="de" (set youtube-dl_lng=A) else set youtube-dl_lng=F
for /F "delims=/ tokens=3,5,6" %%a in ("!mediabuilder_url!") do (set "youtube-dl_lng=%%a" & set "youtube-dl_url=https://www.arte.tv/hbbtvv2/services/web/index.php/OPA/v3/streams/%%b/SHOW/%%a" & echo.%%c)
if /I "!youtube-dl_lng!"=="de" (set youtube-dl_slng=A) else set youtube-dl_slng=F
set youtube-dl_urlvl=""
set youtube-dl_urlvo=""
for /F "skip=15 tokens=1,* delims=: " %%a in ('curl -s -H "Authorization:Bearer Nzc1Yjc1ZjJkYjk1NWFhN2I2MWEwMmRlMzAzNjI5NmU3NWU3ODg4ODJjOWMxNTMxYzEzZGRjYjg2ZGE4MmIwOA" --ssl-no-revoke "!youtube-dl_url!"') do (
if "%%a"==""videoStreams"" (
set youtube-dl_urlvlh=0
set youtube-dl_urlvoh=0
for /F "delims=[] tokens=2" %%a in ('curl -s --ssl-no-revoke "!youtube-dl_url!"') do set "youtube-dl_json=%%a"
if "!youtube-dl_json!" == "}" for /F "delims=[] tokens=2" %%a in ('curl -s --ssl-no-revoke "!youtube-dl_url:/SHOW/=/BONUS/!"') do set "youtube-dl_json=%%a"
set youtube-dl_json=!youtube-dl_json:{=!
set youtube-dl_json=!youtube-dl_json:},=^

!
set youtube-dl_json=!youtube-dl_json:}=!
for /F "usebackq delims=" %%a in ('!youtube-dl_json!') do @(
set "youtubebe-dl_j=%%a"
set youtubebe-dl_j=!youtubebe-dl_j:,=^

!
set youtube-dl_url=""
set youtube-dl_asl=""
) else if "%%a"==""url"" (
set "youtube-dl_url=%%b"
if !youtube-dl_asl!=="V!youtube-dl_lng!" (set "youtube-dl_urlvl=!youtube-dl_url!") else if !youtube-dl_asl!=="VST!youtube-dl_lng!" (set "youtube-dl_urlvo=!youtube-dl_url!")
) else if "%%a"==""audioShortLabel"" (
set "youtube-dl_asl=%%b"
set youtube-dl_h=0
for /F "usebackq delims=: tokens=1,*" %%b in ('!youtubebe-dl_j!') do (
set youtube-dl_s=F
if /I "%%b"==""url"" (
set "youtube-dl_url=%%c"
set youtube-dl_s=T
) else if /I "%%b"==""audioShortLabel"" (
set "youtube-dl_asl=%%c"
set "youtube-dl_asl=!youtube-dl_asl:,=!"
set "youtube-dl_asl=!youtube-dl_asl:O=!"
if !youtube-dl_asl!=="V!youtube-dl_lng!" (set "youtube-dl_urlvl=!youtube-dl_url!") else if !youtube-dl_asl!=="VST!youtube-dl_lng!" (set "youtube-dl_urlvo=!youtube-dl_url!")
set youtube-dl_s=T
) else if /I "%%b"==""height"" (
set "youtube-dl_h=%%c"
set youtube-dl_s=T
)
if !youtube-dl_s!==T (
if /I "!youtube-dl_asl!"==""V!youtube-dl_slng!"" (if !youtube-dl_h! GEQ !youtube-dl_urlvlh! set "youtube-dl_urlvl=!youtube-dl_url!" & set "youtube-dl_urlvlh=!youtube-dl_h!") else if /I "!youtube-dl_asl!"==""VST!youtube-dl_slng!"" (if !youtube-dl_h! GEQ !youtube-dl_urlvoh! set "youtube-dl_urlvo=!youtube-dl_url!" & set "youtube-dl_urlvoh=!youtube-dl_h!") else if /I "!youtube-dl_asl!"==""!youtube-dl_lng!"" (if !youtube-dl_h! GEQ !youtube-dl_urlvlh! set "youtube-dl_urlvl=!youtube-dl_url!" & set "youtube-dl_urlvlh=!youtube-dl_h!")
)
)
)
if !youtube-dl_urlvl!=="" (set youtube-dl_url=!youtube-dl_urlvo:\/=/!) else set youtube-dl_url=!youtube-dl_urlvl:\/=/!
set youtube-dl_url=!youtube-dl_url:~1,-2!
set youtube-dl_url=!youtube-dl_url:~1,-1!
echo.!youtube-dl_url!
echo ###PlayOn_Separator###
)
Expand Down

0 comments on commit a79f7af

Please sign in to comment.