mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
70fa9502f3
commit
431473310f
|
@ -525,6 +525,10 @@ local function add_single_video(json)
|
||||||
local max_bitrate = 0
|
local max_bitrate = 0
|
||||||
local requested_formats = json["requested_formats"]
|
local requested_formats = json["requested_formats"]
|
||||||
local all_formats = json["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
|
if o.use_manifests and valid_manifest(json) then
|
||||||
-- prefer manifest_url if present
|
-- prefer manifest_url if present
|
||||||
|
@ -554,7 +558,6 @@ local function add_single_video(json)
|
||||||
if streamurl == "" then
|
if streamurl == "" then
|
||||||
-- possibly DASH/split tracks
|
-- possibly DASH/split tracks
|
||||||
local res = nil
|
local res = nil
|
||||||
local has_requested_formats = requested_formats and #requested_formats > 0
|
|
||||||
|
|
||||||
-- Not having requested_formats usually hints to HLS master playlist
|
-- Not having requested_formats usually hints to HLS master playlist
|
||||||
-- usage, which we don't want to split off, at least not yet.
|
-- usage, which we don't want to split off, at least not yet.
|
||||||
|
@ -591,7 +594,6 @@ local function add_single_video(json)
|
||||||
end
|
end
|
||||||
-- normal video or single track
|
-- normal video or single track
|
||||||
streamurl = edl_track or json.url
|
streamurl = edl_track or json.url
|
||||||
set_http_headers(json.http_headers)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if streamurl == "" then
|
if streamurl == "" then
|
||||||
|
@ -599,6 +601,8 @@ local function add_single_video(json)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
set_http_headers(http_headers)
|
||||||
|
|
||||||
msg.verbose("format selection: " .. format_info)
|
msg.verbose("format selection: " .. format_info)
|
||||||
msg.debug("streamurl: " .. streamurl)
|
msg.debug("streamurl: " .. streamurl)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue