mirror of
https://github.com/mpv-player/mpv
synced 2024-12-26 00:42:57 +00:00
ytdl_hook.lua: fix some lint warnings
This commit is contained in:
parent
f348a8b303
commit
e5e17c80ba
@ -129,7 +129,7 @@ local function set_http_headers(http_headers)
|
||||
mp.set_property("file-local-options/user-agent", useragent)
|
||||
end
|
||||
local additional_fields = {"Cookie", "Referer", "X-Forwarded-For"}
|
||||
for idx, item in pairs(additional_fields) do
|
||||
for _, item in pairs(additional_fields) do
|
||||
local field_value = http_headers[item]
|
||||
if field_value then
|
||||
headers[#headers + 1] = item .. ": " .. field_value
|
||||
@ -335,7 +335,7 @@ local function make_absolute_url(base_url, url)
|
||||
rest:gsub("([^/]+)", function(c) table.insert(segs, c) end)
|
||||
url:gsub("([^/]+)", function(c) table.insert(segs, c) end)
|
||||
local resolved_url = {}
|
||||
for i, v in ipairs(segs) do
|
||||
for _, v in ipairs(segs) do
|
||||
if v == ".." then
|
||||
table.remove(resolved_url)
|
||||
elseif v ~= "." then
|
||||
@ -478,7 +478,7 @@ local function formats_to_edl(json, formats, use_all_formats)
|
||||
local streams = {}
|
||||
|
||||
local tbr_only = true
|
||||
for index, track in ipairs(formats) do
|
||||
for _, track in ipairs(formats) do
|
||||
tbr_only = tbr_only and track["tbr"] and
|
||||
(not track["abr"]) and (not track["vbr"])
|
||||
end
|
||||
@ -492,8 +492,7 @@ local function formats_to_edl(json, formats, use_all_formats)
|
||||
-- Iterate in reverse to get best track first.
|
||||
for index = #formats, 1, -1 do
|
||||
local track = formats[index]
|
||||
local edl_track = nil
|
||||
edl_track = edl_track_joined(track.fragments,
|
||||
local edl_track = edl_track_joined(track.fragments,
|
||||
track.protocol, json.is_live,
|
||||
track.fragment_base_url)
|
||||
if not edl_track and not url_is_safe(track.url) then
|
||||
@ -686,8 +685,7 @@ local function add_single_video(json)
|
||||
|
||||
if streamurl == "" and json.url then
|
||||
format_info = "youtube-dl (single)"
|
||||
local edl_track = nil
|
||||
edl_track = edl_track_joined(json.fragments, json.protocol,
|
||||
local edl_track = edl_track_joined(json.fragments, json.protocol,
|
||||
json.is_live, json.fragment_base_url)
|
||||
|
||||
if not edl_track and not url_is_safe(json.url) then
|
||||
@ -1075,7 +1073,7 @@ function run_ytdl_hook(url)
|
||||
json.entries[entry_wsubs].duration ~= nil then
|
||||
for j, req in pairs(json.entries[entry_wsubs].requested_subtitles) do
|
||||
local subfile = "edl://"
|
||||
for i, entry in pairs(json.entries) do
|
||||
for _, entry in pairs(json.entries) do
|
||||
if entry.requested_subtitles ~= nil and
|
||||
entry.requested_subtitles[j] ~= nil and
|
||||
url_is_safe(entry.requested_subtitles[j].url) then
|
||||
@ -1096,7 +1094,7 @@ function run_ytdl_hook(url)
|
||||
else
|
||||
local playlist_index = parse_yt_playlist(url, json)
|
||||
local playlist = {"#EXTM3U"}
|
||||
for i, entry in pairs(json.entries) do
|
||||
for _, entry in pairs(json.entries) do
|
||||
local site = entry.url
|
||||
local title = entry.title
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user