summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorChristoph Heinrich <christoph.heinrich@student.tugraz.at>2022-07-15 02:12:58 +0200
committerDudemanguy <random342@airmail.cc>2022-07-18 01:17:00 +0000
commit431473310f9d86f6ae030ce3432897edebe5ab89 (patch)
treef72c5c2f008cbb7b504df67da0df134d0e9a669c /player
parent70fa9502f35014db5e6989af2947f5b61d4a7cf1 (diff)
downloadmpv-431473310f9d86f6ae030ce3432897edebe5ab89.tar.bz2
mpv-431473310f9d86f6ae030ce3432897edebe5ab89.tar.xz
ytdl_hook: always set HTTP headers
In some cases HTTP headers were not set, leading to some sites not working despite being supported by yt-dlp/youtube-dl.
Diffstat (limited to 'player')
-rw-r--r--player/lua/ytdl_hook.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 26913763df..7ff5f5ea00 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -525,6 +525,10 @@ local function add_single_video(json)
local max_bitrate = 0
local requested_formats = json["requested_formats"]
local all_formats = json["formats"]
+ local has_requested_formats = requested_formats and #requested_formats > 0
+ local http_headers = has_requested_formats
+ and requested_formats[1].http_headers
+ or json.http_headers
if o.use_manifests and valid_manifest(json) then
-- prefer manifest_url if present
@@ -554,7 +558,6 @@ local function add_single_video(json)
if streamurl == "" then
-- possibly DASH/split tracks
local res = nil
- local has_requested_formats = requested_formats and #requested_formats > 0
-- Not having requested_formats usually hints to HLS master playlist
-- usage, which we don't want to split off, at least not yet.
@@ -591,7 +594,6 @@ local function add_single_video(json)
end
-- normal video or single track
streamurl = edl_track or json.url
- set_http_headers(json.http_headers)
end
if streamurl == "" then
@@ -599,6 +601,8 @@ local function add_single_video(json)
return
end
+ set_http_headers(http_headers)
+
msg.verbose("format selection: " .. format_info)
msg.debug("streamurl: " .. streamurl)