[vlc-commits] youtube.lua: detect and report very long line issue (#24957)
Pierre Ynard
git at videolan.org
Mon Aug 17 19:04:54 CEST 2020
vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Mon Aug 17 18:46:12 2020 +0200| [291d46be2d81e57d2bc7fe94ab097c27c5ad5150] | committer: Pierre Ynard
youtube.lua: detect and report very long line issue (#24957)
This should save time for both users and maintainers by accurately
detecting and diagnosing the issue, and avoiding duplicate bug reports.
Refs #24957
(cherry picked from commit ca39a2a766cdf751b4a487f9ec3650846f1a0289)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=291d46be2d81e57d2bc7fe94ab097c27c5ad5150
---
share/lua/playlist/youtube.lua | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index fdc2baaeff..2b560ac9e1 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -314,9 +314,11 @@ function parse()
-- fmt is the format of the video
-- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
fmt = get_url_param( vlc.path, "fmt" )
+ local lastline
while true do
local line = vlc.readline()
if not line then break end
+ lastline = line
-- Try to find the video's title
if string.match( line, "<meta property=\"og:title\"" ) then
@@ -409,6 +411,10 @@ function parse()
end
end
+ if not path and lastline and string.match( lastline, '<div id="player%-api">' ) then
+ vlc.msg.err( "YouTube web page truncated at very long line, please check https://trac.videolan.org/vlc/ticket/24957 for updates to this issue" )
+ end
+
if not path then
local video_id = get_url_param( vlc.path, "v" )
if video_id then
@@ -434,6 +440,10 @@ function parse()
elseif string.match( vlc.path, "/get_video_info%?" ) then -- video info API
local line = vlc.readline() -- data is on one line only
+ if not line then
+ vlc.msg.err( "YouTube API output missing: probably rejected as very long line, please check https://trac.videolan.org/vlc/ticket/24957 for updates to this issue" )
+ return { }
+ end
-- Classic parameters - out of use since early 2020
local fmt = get_url_param( vlc.path, "fmt" )
More information about the vlc-commits
mailing list