Skip to content

Instantly share code, notes, and snippets.

@p3g4asus
Forked from Seneral/0 Warning.md
Last active January 4, 2023 18:20
Show Gist options
  • Save p3g4asus/597050997e01f8fd1fcf473fe6545a4f to your computer and use it in GitHub Desktop.
Save p3g4asus/597050997e01f8fd1fcf473fe6545a4f to your computer and use it in GitHub Desktop.
Modified VLC YouTube playlist parsing script. The original script was not working anymore because youtube removed the list_ajax interface. Unfortunately the new interface requires at least http GET method with proper headers and they are not supported by vlc. So this version makes use of an external program (youtube-dl). Disclaimer: this version…
--[[
Youtube playlist importer for VLC media player 1.1 and 2.0
Copyright 2012 Guillaume Le Maout
Authors: Guillaume Le Maout
Contact: http://addons.videolan.org/messages/?action=newmessage&username=exebetche
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
--[[
MODified by Kai Gillmann, 19.01.2013, [email protected]:
VLC HAS already a youtube importer, but not for playlists. IMO this mentioned one is
better than this one, because it opens the video in the best possible video resolution.
So i decided to remove all parts of the code which is not responsible for list handling.
Now this lua script parses the list, as wanted, but for each video opened, the vlc default
Youtube script is used, so the videos will be displayed properly.
--]]
--[[
Youtube playlist importer for VLC media player 1.1 and 2.0
Copyright 2012 Guillaume Le Maout
Authors: Guillaume Le Maout
Contact: http://addons.videolan.org/messages/?action=newmessage&username=exebetche
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
--[[
MODified by Kai Gillmann, 19.01.2013, [email protected]:
VLC HAS already a youtube importer, but not for playlists. IMO this mentioned one is
better than this one, because it opens the video in the best possible video resolution.
So i decided to remove all parts of the code which is not responsible for list handling.
Now this lua script parses the list, as wanted, but for each video opened, the vlc default
Youtube script is used, so the videos will be displayed properly.
--]]
--[[
Patched by Aaron Hill (https://github.com/seraku24), 2018-05-16:
The original script was failing in VLC 3.x due to an overzealous probe function.
This patch makes the probe function more restrictive to avoid false positives.
--]]
--[[
Patched by Matteo Federico Zazzetta (https://github.com/p3g4asus), 2020-02-17:
The original script was not working anymore because youtube removed the list_ajax interface.
Unfortunately the new interface requires at least http GET method with proper headers and
they are not supported by vlc. So this version makes use of an external program (youtube-dl).
Disclaimer: this version works only under Windows. It can be easily ported but I have no way to test
it on other OS at the moment.
Installation (under Windows): place this file in the lua playlist vlc folder together with JSON.lua
(http://regex.info/code/JSON.lua) and youtube-dl.exe (https://youtube-dl.org/latest)
--]]
-- Probe function.
function probe()
if vlc.access ~= "http" and vlc.access ~= "https" then
return false
end
return string.match(vlc.path:match("([^/]+)"),"%w+.youtube.com") and (
not string.match(vlc.path, "list_ajax") and string.match(vlc.path, "[?&]list="))
end
local function isdef(p,...)
if not p then
return false
else
local tb = p
for i,v in ipairs(arg) do
if tb[v]==nil then
return false
else
tb = tb[v]
end
end
return true
end
end
function Log(lm)
vlc.msg.info("[youtube_pl.lua] " .. tostring(lm))
end
function get_url_param( url, name )
local _, _, res = string.find( url, "[&?]"..name.."=([^&]*)" )
return res
end
function try_yt_dl(lst)
local info = debug.getinfo(1,'S');
local kk,jj,ll = string.match(string.sub(info.source,2), "(.-)([^\\/]-%.?([^%.\\/]*))$")
Log("Trying ytdl "..kk)
local link = vlc.access.."://www.youtube.com/playlist?list="..lst
local JSON = (loadfile (kk.."JSON.lua"))()
local bat_dir3 = "cmd /k \"\""..kk.."youtube-dl.exe\" -j --flat-playlist \""..link.."\"\""
local f = assert(io.popen (bat_dir3, 'r'))
local p = {}
Log("Exec "..bat_dir3)
-- local bat_dir2 = "> \""..kk.."youtube-dl.txt\" \""..kk.."youtube-dl.exe\" -j --flat-playlist \""..link.."\""
-- Log("Exec "..bat_dir2)
-- os.execute(bat_dir2)
-- local outfile = kk.."youtube-dl.txt"
-- Log("Open "..outfile)
local p = {}
for json in f:lines() do
Log(json)
local rv, pall = pcall(function () return JSON:decode(json) end)
if rv and isdef(pall,"id") then
local item = {}
item.path = "https://www.youtube.com/watch?v="..pall.id
if isdef(pall,"title") then
item.title = pall.title
end
if isdef(pall,"duration") then
item.duration = math.floor(tonumber(pall.duration))
end
table.insert (p, item)
end
end
f:close()
return p
end
-- Parse function.
function parse()
if string.match( vlc.path, "list=" ) then
local lst = get_url_param(vlc.path, "list")
return try_yt_dl(lst)
end
end
@Seneral
Copy link

Seneral commented Feb 18, 2021

Thanks, works nicely. Btw there are two copies of the script in the file

@p3g4asus
Copy link
Author

Thanks, works nicely. Btw there are two copies of the script in the file

Ops: you are right. Fixed

@czoins
Copy link

czoins commented Feb 18, 2021

I suggest using io.popen() and reading its output instead of writing a file, maybe it would be faster?
Also is it possible to play the video provided in the playlist link (watch?v=) instead of playing the playlist from the beginning? it used to work that way with the old script, so i am sure the logic can be found there.
I would help, but i am not well versed in Lua.

@p3g4asus
Copy link
Author

p3g4asus commented Feb 18, 2021

I suggest using io.popen() and reading its output instead of writing a file, maybe it would be faster?
Also is it possible to play the video provided in the playlist link (watch?v=) instead of playing the playlist from the beginning? it used to work that way with the old script, so i am sure the logic can be found there.
I would help, but i am not well versed in Lua.

Nice suggestion. I will try to use it. Could please provide an example of the link that contains the video of the playlist?
Thank you

@czoins
Copy link

czoins commented Feb 18, 2021

A random playlist:
https://www.youtube.com/playlist?list=PLbpi6ZahtOH4pokHV8yY5mk42_cMRMK8s

2nd video:
https://www.youtube.com/watch?v=hFZFjoX2cGg&list=PLbpi6ZahtOH4pokHV8yY5mk42_cMRMK8s&index=2

If you use the second link in VLC, it starts playing from the 1st video instead of the 2nd one.

Copy link

ghost commented Feb 18, 2021

Works wonderfully, once you realize that you don't want the ytdl LUA! Thank you very much for updating the script's code!

Edit: YTDL & FFmpeg (for Windows 10, versions 1909 & higher) must be installed to your System's Environment Variables under System Variables > Path (This cannot be automated non-destructively.)
The 32-bit install of VLC (via MSI installer) might also be required.

I have 0 ways of testing this with Mac & Linux.

@p3g4asus
Copy link
Author

A random playlist:
https://www.youtube.com/playlist?list=PLbpi6ZahtOH4pokHV8yY5mk42_cMRMK8s

2nd video:
https://www.youtube.com/watch?v=hFZFjoX2cGg&list=PLbpi6ZahtOH4pokHV8yY5mk42_cMRMK8s&index=2

If you use the second link in VLC, it starts playing from the 1st video instead of the 2nd one.

This should be quite easy to implement. I will try to add this feature in the next version.

@p3g4asus
Copy link
Author

A random playlist:
https://www.youtube.com/playlist?list=PLbpi6ZahtOH4pokHV8yY5mk42_cMRMK8s

2nd video:
https://www.youtube.com/watch?v=hFZFjoX2cGg&list=PLbpi6ZahtOH4pokHV8yY5mk42_cMRMK8s&index=2

If you use the second link in VLC, it starts playing from the 1st video instead of the 2nd one.

How do you want this to work? vlc should start playing the playlist from the second video and then continue with the third? Where should the first video of the playlist be in vlc playlist? It cannot be in the first position because, otherwise, vlc will play it as first. AFAIK in a playlist extension I cannot tell vlc to skip a video.

@czoins
Copy link

czoins commented Feb 18, 2021

It should play the 2nd, then 3rd and so on yes. And the 1st one remains before the 2nd one, but doesn't play initially. It used to work that way with the other one, i am not sure how they did it though.

For more clarification:

VLC playlist:
1st video
2nd video <- plays initially
3rd video <- plays next

@Seneral
Copy link

Seneral commented Feb 18, 2021

I suggest using io.popen() and reading its output instead of writing a file, maybe it would be faster?
Also is it possible to play the video provided in the playlist link (watch?v=) instead of playing the playlist from the beginning? it used to work that way with the old script, so i am sure the logic can be found there.
I would help, but i am not well versed in Lua.

Works wonderfully, once you realize that you don't want the ytdl LUA! Thank you very much for updating the script's code!

For reference, ytdl lua (which I didn't know existed) works similarly and uses io.popen already, might be a nice reference.

@p3g4asus
Copy link
Author

I edited the script to use io.popen instead of os.execute. This way the intermediate file is not generated anymore. However that did not speed up the process noticeably.

@p3g4asus
Copy link
Author

It should play the 2nd, then 3rd and so on yes. And the 1st one remains before the 2nd one, but doesn't play initially. It used to work that way with the other one, i am not sure how they did it though.

For more clarification:

VLC playlist:
1st video
2nd video <- plays initially
3rd video <- plays next

Honestly I don't see how this can be done with vlc playlist lua API. I can create the playlist without the first video or putting the first video at the end. Starting to play the playlist from the second video seems not feasible to me. If anyone knows how this can be done, please suggest.

@TexShowWL
Copy link

It does not work for me.
Here are the logs:

main debug: using demux module "directory"
main debug: looking for meta reader module matching "any": 2 candidates
lua debug: Trying Lua scripts in C:\Users\texsh\AppData\Roaming\vlc\lua\meta\reader
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\reader
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\reader\filename.luac
main debug: no meta reader modules matched
main debug: `file/directory:///C:/Users/texsh/AppData/Roaming/vlc/ml.xspf' successfully opened
main debug: looking for xml reader module matching "any": 1 candidates
main debug: using xml reader module "xml"
main debug: EOF reached
main debug: removing module "directory"
main debug: removing module "record"
main debug: removing module "playlist"
main debug: removing module "cache_read"
main debug: removing module "filesystem"
main debug: creating audio output
main debug: looking for audio output module matching "any": 7 candidates
mmdevice debug: using default device
mmdevice debug: display name changed: VLC media player
mmdevice debug: version 2 session control unavailable
mmdevice debug: volume from -96.000000 dB to +0.000000 dB with 1.500000 dB increments
main debug: using audio output module "mmdevice"
main debug: keeping audio output
main debug: looking for interface module matching "hotkeys,none": 16 candidates
main debug: using interface module "hotkeys"
main debug: looking for interface module matching "globalhotkeys,none": 16 candidates
main debug: using interface module "win32"
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
main debug: looking for interface module matching "any": 16 candidates
main debug: looking for extension module matching "any": 1 candidates
lua debug: Opening Lua Extension module
lua debug: Trying Lua scripts in C:\Users\texsh\AppData\Roaming\vlc\lua\extensions
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\extensions
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\extensions\VLSub.luac
lua debug: Scanning Lua script C:\Program Files\VideoLAN\VLC\lua\extensions\VLSub.luac
lua debug: Script C:\Program Files\VideoLAN\VLC\lua\extensions\VLSub.luac has the following capability flags: 0x5
main debug: using extension module "lua"
main debug: using interface module "qt"
main: playlist is empty
main debug: nothing to play
main debug: processing request item: playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV, node: Playlist, skip: 0
main debug: rebuilding array of current - root Playlist
main debug: rebuild done - 1 items, index 0
main debug: starting playback of new item
main debug: resyncing on playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV
main debug: playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV is at 0
main debug: creating new input thread
main debug: Creating an input for 'playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV'
main debug: requesting art for new input thread
main debug: using timeshift granularity of 50 MiB
main debug: using timeshift path: C:\Users\texsh\AppData\Local\Temp
main debug: `https://www.youtube.com/playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV' gives access `https' demux `any' path `www.youtube.com/playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV'
main debug: creating demux: access='https' demux='any' location='www.youtube.com/playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV' file='\\www.youtube.com\playlist'
main debug: looking for access_demux module matching "https": 15 candidates
main debug: no access_demux modules matched
main debug: creating access: https://www.youtube.com/playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV
main debug:  (path: \\www.youtube.com\playlist)
main debug: looking for access module matching "https": 27 candidates
main debug: looking for meta fetcher module matching "any": 1 candidates
lua debug: Trying Lua scripts in C:\Users\texsh\AppData\Roaming\vlc\lua\meta\fetcher
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\fetcher
main debug: no meta fetcher modules matched
main debug: looking for art finder module matching "any": 2 candidates
lua debug: Trying Lua scripts in C:\Users\texsh\AppData\Roaming\vlc\lua\meta\art
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\art
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
qt debug: IM: Setting an input
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
main debug: looking for tls client module matching "any": 1 candidates
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
main debug: no art finder modules matched
gnutls debug: using GnuTLS version 3.6.15
main debug: looking for meta fetcher module matching "any": 1 candidates
lua debug: Trying Lua scripts in C:\Users\texsh\AppData\Roaming\vlc\lua\meta\fetcher
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\fetcher
main debug: no meta fetcher modules matched
main debug: looking for art finder module matching "any": 2 candidates
lua debug: Trying Lua scripts in C:\Users\texsh\AppData\Roaming\vlc\lua\meta\art
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\art
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
main debug: no art finder modules matched
gnutls debug: loaded 60 trusted CAs from system
main debug: using tls client module "gnutls"
main debug: resolving www.youtube.com ...
gnutls debug: TLS handshake: Resource temporarily unavailable, try again.
gnutls debug: TLS handshake: Resource temporarily unavailable, try again.
gnutls debug: TLS handshake: Success.
http debug: out SETTINGS (0x04) frame of 30 bytes, flags 0x00, global
http debug: out HEADERS (0x01) frame of 201 bytes, flags 0x05, stream 1
http debug: in SETTINGS (0x04) frame of 18 bytes, flags 0x00, global
http debug: setting: Concurrent streams (0x0003): 100
http debug: setting: Initial window size (0x0004): 1048576
http debug: setting: Header list size (0x0006): 16384
http debug: out SETTINGS (0x04) frame of 0 bytes, flags 0x01, global
http debug: in WINDOW_UPDATE (0x08) frame of 4 bytes, flags 0x00, global
http debug: in SETTINGS (0x04) frame of 0 bytes, flags 0x01, global
http debug: in HEADERS (0x01) frame of 735 bytes, flags 0x04, stream 1
http debug: stream 1 17 headers:
http debug:  :status: "200"
http debug:  content-type: "text/html; charset=utf-8"
http debug:  x-content-type-options: "nosniff"
http debug:  cache-control: "no-cache, no-store, max-age=0, must-revalidate"
http debug:  pragma: "no-cache"
http debug:  expires: "Mon, 01 Jan 1990 00:00:00 GMT"
http debug:  date: "Fri, 19 Feb 2021 13:56:12 GMT"
http debug:  x-frame-options: "SAMEORIGIN"
http debug:  strict-transport-security: "max-age=31536000"
http debug:  p3p: "CP="This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en-GB for more info.""
http debug:  server: "ESF"
http debug:  x-xss-protection: "0"
http debug:  set-cookie: "GPS=1; Domain=.youtube.com; Expires=Fri, 19-Feb-2021 14:26:12 GMT; Path=/; Secure; HttpOnly"
http debug:  set-cookie: "YSC=Pe869UP1ThY; Domain=.youtube.com; Path=/; Secure; HttpOnly; SameSite=none"
http debug:  set-cookie: "VISITOR_INFO1_LIVE=6L-QEXoFerA; Domain=.youtube.com; Expires=Wed, 18-Aug-2021 13:56:12 GMT; Path=/; Secure; HttpOnly; SameSite=none"
http debug:  set-cookie: "CONSENT=PENDING+002; expires=Fri, 01-Jan-2038 00:00:00 GMT; path=/; domain=.youtube.com"
http debug:  alt-svc: "h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43""
main debug: using access module "access"
main debug: looking for stream_filter module matching "prefetch,cache_block": 24 candidates
prefetch debug: using 16777216 bytes buffer, 16777216 bytes read
main debug: using stream_filter module "prefetch"
main debug: looking for stream_filter module matching "any": 24 candidates
http debug: in DATA (0x00) frame of 13963 bytes, flags 0x00, stream 1
http debug: out (priority) WINDOW_UPDATE (0x08) frame of 4 bytes, flags 0x00, global
http debug: in DATA (0x00) frame of 173 bytes, flags 0x00, stream 1
lua debug: Trying Lua scripts in C:\Users\texsh\AppData\Roaming\vlc\lua\playlist
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\playlist
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\playlist\149909-playlist_youtube.lua
lua debug: Lua playlist script C:\Program Files\VideoLAN\VLC\lua\playlist\149909-playlist_youtube.lua's probe() function was successful
main debug: using stream_filter module "lua"
main debug: stream filter added to 0000017c8d5d9630
main debug: looking for stream_filter module matching "any": 24 candidates
main debug: no stream_filter modules matched
main debug: looking for stream_directory module matching "any": 1 candidates
main debug: no stream_directory modules matched
main debug: attachment of directory-extractor failed for https://www.youtube.com/playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV
main debug: looking for stream_filter module matching "record": 24 candidates
main debug: using stream_filter module "record"
main debug: creating demux: access='https' demux='any' location='www.youtube.com/playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV' file='\\www.youtube.com\playlist'
main debug: looking for demux module matching "any": 55 candidates
http debug: in DATA (0x00) frame of 16384 bytes, flags 0x00, stream 1
es debug: cannot peek
es debug: cannot peek
http debug: in DATA (0x00) frame of 176 bytes, flags 0x00, stream 1
es debug: cannot peek
es debug: cannot peek
es debug: cannot peek
http debug: in DATA (0x00) frame of 16376 bytes, flags 0x00, stream 1
http debug: in DATA (0x00) frame of 15917 bytes, flags 0x00, stream 1
http debug: in DATA (0x00) frame of 173 bytes, flags 0x00, stream 1
http debug: in DATA (0x00) frame of 2373 bytes, flags 0x00, stream 1
http debug: in DATA (0x00) frame of 14003 bytes, flags 0x00, stream 1
http debug: out (priority) WINDOW_UPDATE (0x08) frame of 4 bytes, flags 0x00, global
http debug: in DATA (0x00) frame of 16384 bytes, flags 0x00, stream 1
http debug: in DATA (0x00) frame of 16376 bytes, flags 0x00, stream 1
mod debug: MOD validation failed (ext=com\playlist)
main debug: using demux module "directory"
main debug: looking for meta reader module matching "any": 2 candidates
lua debug: Trying Lua scripts in C:\Users\texsh\AppData\Roaming\vlc\lua\meta\reader
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\reader
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\reader\filename.luac
http debug: in DATA (0x00) frame of 16384 bytes, flags 0x00, stream 1
main debug: no meta reader modules matched
main debug: `https://www.youtube.com/playlist?list=PLgBNJb4xFYkbMD7eh5tQP_UNHkTOG7BXV' successfully opened
lua: [youtube_pl.lua] Trying ytdl C:\Program Files\VideoLAN\VLC\lua\playlist\
lua warning: error running script C:\Program Files\VideoLAN\VLC\lua\playlist\149909-playlist_youtube.lua: function parse(): ...ideoLAN\VLC\lua\playlist\149909-playlist_youtube.lua:120: attempt to call a nil value
directory warning: unable to read directory
main debug: removing module "directory"
main debug: removing module "record"
main debug: removing module "lua"
main debug: removing module "

@p3g4asus
Copy link
Author

p3g4asus commented Feb 19, 2021

It does not work for me.
Here are the logs:

lua warning: error running script C:\Program Files\VideoLAN\VLC\lua\playlist\149909-playlist_youtube.lua: function parse(): ...ideoLAN\VLC\lua\playlist\149909-playlist_youtube.lua:120: attempt to call a nil value

Did you copy JSON.lua in the same directory of the script lua file?

@Picoseconds
Copy link

It does not work for me, every video name is replaced with get_video_info and then it disappears from the view

@p3g4asus
Copy link
Author

It does not work for me, every video name is replaced with get_video_info and then it disappears from the view

That is a problem with youtube vlc extension.
Today youtube modified something in get_video_info interface and now even youtube vlc playlist extension does not work anymore.
I hope the wil fix it soon (if it can be fixed). In the meanwhile the only workaround is to use ytdl lua

@Druxtt
Copy link

Druxtt commented Feb 23, 2021

omg, will youtube stop modifying all their stuff i can't play youtube video longer than 10 min anymore ! that's so annoying !

@Picoseconds
Copy link

I have updated VLC and it is better now, but most videos can't play from any music/copyright channels.

@Druxtt
Copy link

Druxtt commented Feb 23, 2021

I have updated VLC and it is better now, but most videos can't play from any music/copyright channels.

Yep you're right but man... That's what I've been using vlc for smh

@Seneral
Copy link

Seneral commented Feb 23, 2021

I have updated VLC and it is better now, but most videos can't play from any music/copyright channels.

Yeah my FlagPlayer broke as well on some videos, YouTube slightly changed formats for parts of their stream encoding. But that's not likely the issue you were having with youtube-dl, my older version works just fine on some of these videos.
Basically youtube checks if the IP that requested the webpage is the same as the one requesting the stream, for some copyrighted videos, which might be what you're experiencing - although I don't know why youtube-dl would be using a proxy, so not sure if that is actually the problem.
Can you share a link that currently does not work with youtube-dl?

@Picoseconds
Copy link

I installed the youtube-dl lua and then it is worse and 0 videos can play

@Daniel-Mendes
Copy link

Daniel-Mendes commented Jun 8, 2021

Hi, I worked on a version that use the code source of the playlist to extract the data (I use the ytInitialData from javascript to get the data), it works with /watch?v=XXX&list=XXXX and /playlist?list=XXXX urls and I want to add support of music.youtube.com/watch?list=XXX and music.youtube.com/playlist?list=XXX.

WARNING: if Youtube update there code, my parser will not work any more and will need an update.

https://gist.github.com/Daniel-Mendes/21cff1d94b584769fa05a4905bd272b5

Copy link

ghost commented Jun 15, 2021

I installed the youtube-dl lua and then it is worse and 0 videos can play

The YTDL LUA overrides this script. REMOVE IT.

@NeuroCPP
Copy link

I installed the youtube-dl lua and then it is worse and 0 videos can play

The YTDL LUA overrides this script. REMOVE IT.
Yes you said it right...but will it work without yt dl....while until then I am using this edition Made By @Daniel-Mendes
LINK TO FILE: https://gist.github.com/Daniel-Mendes/21cff1d94b584769fa05a4905bd272b5
NOTE::-- IT ONLY WORKS UPTO 100 videos in a playlist...sometimes it will discard the playlist after reading if the playlist if it has 100+ videos

@Killer-931
Copy link

Killer-931 commented Aug 13, 2021

Hey! I have used this extension before, by some Miracle I figured out how to get it to work. I did something recently, don't know what, I can't remember how to get the Extension to work, it took me hours last time and I am not a Code Genius.

Could someone make a step by step for absolutely brain dead people like me and others? We'd really appreciate it, a short video would be great!

Edit: Okay, I figured it out, Mostly. So, I reinstalled VLC, fully wiped all it's data. Went into AppData and Roaming, made the Lua and Extensions and Playlist folder. Putting it all in Playlist there, it Works, except it Doesn't.

So, it won't play 90% of the Songs, I guess it's a region Restriction thing, I'm from Australia though and normal browsing I have no Restrictions on the Songs that aren't playing Normally.

How do I go about making VLC play these 'Restricted' Songs?

@Seneral
Copy link

Seneral commented Aug 13, 2021

Not sure tbh but you could try if other custom software has similar issues with it. E.g. I made FlagPlayer and there are certain copyrighted videos it can't play if it is using a public proxy server (default, though you can easily host one locally). VLC should not have a problem with that due to not being a website, I would expect it to play back all videos. So if you find FlagPlayer can play them, I would file a bug with VLC (or the maintainer of the YouTube watch plugin, not this one). If it can't, it should give you some idea to why (you could even send me a link if it's not clear why and I'll test).
https://flagplayer.seneral.dev/ (Comments are broken again and there's a weird video length bug only on firefox but apart from that videos should play fine).
One thing I will say is that YouTube sometimes just doesn't load a video, both through FlagPlayer or the official website, until you reload. Not sure if YouTube detects foreign traffic by other programs and adds unreliability after some time, but got nothing to compare with to verify.

@vladscript
Copy link

Thanks! it solved an issue to me (no idea why or how) regarding error http 403 of mi AHK script to extract/insert URLsof playlist to VLC YouPlayTubeList

@czoins
Copy link

czoins commented Aug 22, 2021

For those unable to play most videos (403 HTTP error), i have updated the youtube.lua script to use youtube-dl to get the link. Updated script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment