tiborbaksa / vlc-mediaklikk-video

VLC playlist parser for MédiaKlikk videos and video streams
MIT License
9 stars 2 forks source link

error running script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mediaklikk-video.lua #5

Closed makaivelli closed 1 year ago

makaivelli commented 1 year ago

Hey,

I'm trying to watch M4 stream on VLC 3.0.17.3 Vetinari (Apple Silicon). After copying your script to the playlist folder and trying to opening https://www.mediaklikk.hu/m4-elo, I'm getting this message:

main debug: VLC media player - 3.0.17.3 Vetinari
main debug: Copyright © 1996-2022 the VideoLAN team
main debug: revision 3.0.17.3-0-g426513d88e
main debug: configured with /Users/d-fu/vlc-3.0/extras/package/macosx/../../../configure  '--prefix=/Users/d-fu/vlc-3.0/build-arm64/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-osx-notifications' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-avfoundation' '--disable-skins2' '--disable-xcb' '--disable-caca' '--disable-pulse' '--disable-sdl-image' '--disable-vnc' '--build=x86_64-apple-darwin19' '--host=aarch64-apple-darwin19' '--with-macosx-version-min=10.7' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' '--with-breakpad=https://mac.crashes.videolan.org' 'build_alias=x86_64-apple-darwin19' 'host_alias=aarch64-apple-darwin19' 'CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' 'CFLAGS=-g -arch arm64' 'LDFLAGS=-arch arm64' 'CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++' 'CXXFLAGS=-g -arch arm64' 'OBJC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' 'OBJCFLAGS=-g -arch arm64'
main debug: processing request item: m4-elo, node: Playlist, skip: 0
main debug: resyncing on m4-elo
main debug: m4-elo is at 0
main debug: starting playback of new item
main debug: resyncing on m4-elo
main debug: m4-elo is at 0
main debug: creating new input thread
main debug: Creating an input for 'm4-elo'
main debug: requesting art for new input thread
main debug: using timeshift granularity of 50 MiB
main debug: using default timeshift path
main debug: `https://www.mediaklikk.hu/m4-elo' gives access `https' demux `any' path `www.mediaklikk.hu/m4-elo'
main debug: creating demux: access='https' demux='any' location='www.mediaklikk.hu/m4-elo' file='(null)'
main debug: looking for access_demux module matching "https": 14 candidates
main debug: no access_demux modules matched
main debug: creating access: https://www.mediaklikk.hu/m4-elo
main debug: looking for access module matching "https": 24 candidates
main debug: looking for tls client module matching "any": 2 candidates
securetransport debug: open st client
main debug: using tls client module "securetransport"
main debug: resolving www.mediaklikk.hu ...
main debug: looking for meta fetcher module matching "any": 1 candidates
lua debug: Trying Lua scripts in /Users/adammakai/Library/Application Support/org.videolan.vlc/lua/meta/fetcher
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/lua/meta/fetcher
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/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 /Users/adammakai/Library/Application Support/org.videolan.vlc/lua/meta/art
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/lua/meta/art
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/art
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/00_musicbrainz.luac
lua debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/00_musicbrainz.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/01_googleimage.luac
lua debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/01_googleimage.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/02_frenchtv.luac
lua debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/02_frenchtv.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/03_lastfm.luac
lua debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/03_lastfm.luac
main debug: no art finder modules matched
main debug: looking for meta fetcher module matching "any": 1 candidates
lua debug: Trying Lua scripts in /Users/adammakai/Library/Application Support/org.videolan.vlc/lua/meta/fetcher
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/lua/meta/fetcher
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/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 /Users/adammakai/Library/Application Support/org.videolan.vlc/lua/meta/art
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/lua/meta/art
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/art
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/00_musicbrainz.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/01_googleimage.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/02_frenchtv.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/03_lastfm.luac
main debug: no art finder modules matched
securetransport warning: Ignoring ALPN request due to lack of support in the backend. Proxy behavior potentially undefined.
securetransport debug: open TLS session for www.mediaklikk.hu
securetransport debug: handshake is blocked, try again later
securetransport debug: SSLHandshake returned errSSLServerAuthCompleted, continuing handshake
securetransport debug: handshake is blocked, try again later
securetransport debug: cerfificate verification successful, result is 4
securetransport debug: handshake completed successfully
http debug: outgoing request:
GET /m4-elo HTTP/1.1
Host: www.mediaklikk.hu
Accept: */*
Accept-Language: en_GB
User-Agent: VLC/3.0.17.3 LibVLC/3.0.17.3
Range: bytes=0-

http debug: incoming response:
HTTP/1.1 301 Moved Permanently
content-length: 0
location: https://mediaklikk.hu/m4-elo

securetransport debug: shutdown TLS session
securetransport debug: close TLS session
securetransport debug: close secure transport client
main debug: no access modules matched
main debug: redirecting to: https://mediaklikk.hu/m4-elo
main debug: creating access: https://mediaklikk.hu/m4-elo
main debug: looking for access module matching "https": 24 candidates
main debug: looking for tls client module matching "any": 2 candidates
securetransport debug: open st client
main debug: using tls client module "securetransport"
main debug: resolving mediaklikk.hu ...
securetransport warning: Ignoring ALPN request due to lack of support in the backend. Proxy behavior potentially undefined.
securetransport debug: open TLS session for mediaklikk.hu
securetransport debug: handshake is blocked, try again later
securetransport debug: handshake is blocked, try again later
securetransport debug: handshake is blocked, try again later
securetransport debug: SSLHandshake returned errSSLServerAuthCompleted, continuing handshake
securetransport debug: handshake is blocked, try again later
securetransport debug: cerfificate verification successful, result is 4
securetransport debug: handshake completed successfully
http debug: outgoing request:
GET /m4-elo HTTP/1.1
Host: mediaklikk.hu
Accept: */*
Accept-Language: en_GB
User-Agent: VLC/3.0.17.3 LibVLC/3.0.17.3
Cookie: SERVERID=mtvacookieD
Range: bytes=0-

http debug: incoming response:
HTTP/1.1 301 Moved Permanently
content-type: text/html; charset=UTF-8
vary: Accept-Encoding, Cookie
location: https://m4sport.hu/elo/mtv4live/
x-cacheable: YES
content-length: 0
accept-ranges: bytes
date: Tue, 22 Nov 2022 15:24:40 GMT
age: 14
x-cache: cached
x-ua-compatible: IE=edge,chrome=1
content-security-policy: frame-ancestors 'self' www.mediaklikk.hu mediaklikk.hu www.hirado.hu hirado.hu www.petofilive.hu petofilive.hu m4sport.hu www.m4sport.hu *.mtv.hu sziget.hu *.sziget.hu kas.de www.kas.de *.kas.de ajtk.hu www.ajtk.hu *.ajtk.hu kormany.hu *.kormany.hu maestrokarmesterverseny.hu *.maestrokarmesterverseny.hu *.connectmedia.hu magyaridok.hu *.magyaridok.hu figyelo.hu *.figyelo.hu ripost.hu *.ripost.hu origo.hu *.origo.hu 888.hu *.888.hu pestisracok.hu *.pestisracok.hu adal.hu *.adal.hu sbsgroup.hu *.sbsgroup.hu creativeagent.hu *.creativeagent.hu oldal.info *.oldal.info startlap.hu *.startlap.hu hirstart.hu *.hirstart.hu ridikul.hu *.ridikul.hu reformatus.hu *.reformatus.hu blikk.hu *.blikk.hu *.mtva.appsters.me;
x-frame-options: SAMEORIGIN

securetransport debug: shutdown TLS session
securetransport debug: close TLS session
securetransport debug: close secure transport client
main debug: no access modules matched
main debug: redirecting to: https://m4sport.hu/elo/mtv4live/
main debug: creating access: https://m4sport.hu/elo/mtv4live/
main debug: looking for access module matching "https": 24 candidates
main debug: looking for tls client module matching "any": 2 candidates
securetransport debug: open st client
main debug: using tls client module "securetransport"
main debug: resolving m4sport.hu ...
securetransport warning: Ignoring ALPN request due to lack of support in the backend. Proxy behavior potentially undefined.
securetransport debug: open TLS session for m4sport.hu
securetransport debug: handshake is blocked, try again later
securetransport debug: handshake is blocked, try again later
securetransport debug: SSLHandshake returned errSSLServerAuthCompleted, continuing handshake
securetransport debug: handshake is blocked, try again later
securetransport debug: cerfificate verification successful, result is 4
securetransport debug: handshake completed successfully
http debug: outgoing request:
GET /elo/mtv4live/ HTTP/1.1
Host: m4sport.hu
Accept: */*
Accept-Language: en_GB
User-Agent: VLC/3.0.17.3 LibVLC/3.0.17.3
Cookie: SERVERID=mtvacookieD
Range: bytes=0-

http debug: incoming response:
HTTP/1.1 200 OK
content-type: text/html
vary: Accept-Encoding
etag: W/"637ce7cc-1db040"
x-cacheable: YES
transfer-encoding: chunked
date: Tue, 22 Nov 2022 15:24:40 GMT
age: 85
x-cache: cached
x-ua-compatible: IE=edge,chrome=1
content-security-policy: frame-ancestors 'self' www.mediaklikk.hu mediaklikk.hu www.hirado.hu hirado.hu www.petofilive.hu petofilive.hu m4sport.hu www.m4sport.hu *.mtv.hu sziget.hu *.sziget.hu kas.de www.kas.de *.kas.de ajtk.hu www.ajtk.hu *.ajtk.hu kormany.hu *.kormany.hu maestrokarmesterverseny.hu *.maestrokarmesterverseny.hu *.connectmedia.hu magyaridok.hu *.magyaridok.hu figyelo.hu *.figyelo.hu ripost.hu *.ripost.hu origo.hu *.origo.hu 888.hu *.888.hu pestisracok.hu *.pestisracok.hu adal.hu *.adal.hu sbsgroup.hu *.sbsgroup.hu creativeagent.hu *.creativeagent.hu oldal.info *.oldal.info startlap.hu *.startlap.hu hirstart.hu *.hirstart.hu ridikul.hu *.ridikul.hu reformatus.hu *.reformatus.hu blikk.hu *.blikk.hu *.mtva.appsters.me;
x-frame-options: SAMEORIGIN

main debug: using access module "access"
main debug: looking for stream_filter module matching "prefetch,cache_block": 26 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": 26 candidates
lua debug: Trying Lua scripts in /Users/adammakai/Library/Application Support/org.videolan.vlc/lua/playlist
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/lua/playlist
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/playlist
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_streams.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_xml.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/appletrailers.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/bbc_co_uk.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/cue.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/dailymotion.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/jamendo.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/koreus.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/liveleak.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mediaklikk-video.lua
lua debug: Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mediaklikk-video.lua's probe() function was successful
main debug: using stream_filter module "lua"
main debug: stream filter added to 0x131615ab0
main debug: looking for stream_filter module matching "any": 26 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://m4sport.hu/elo/mtv4live/
main debug: looking for stream_filter module matching "record": 26 candidates
main debug: using stream_filter module "record"
main debug: creating demux: access='https' demux='any' location='www.mediaklikk.hu/m4-elo' file='(null)'
main debug: looking for demux module matching "any": 55 candidates
es debug: cannot peek
es debug: cannot peek
es debug: cannot peek
es debug: cannot peek
es debug: cannot peek
mod debug: MOD validation failed (ext=)
main debug: using demux module "directory"
main debug: looking for meta reader module matching "any": 2 candidates
lua debug: Trying Lua scripts in /Users/adammakai/Library/Application Support/org.videolan.vlc/lua/meta/reader
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/lua/meta/reader
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac
main debug: no meta reader modules matched
main debug: `https://www.mediaklikk.hu/m4-elo' successfully opened
macosx debug: Activated assertion NoIdleSleepAssertion through IOKit (37586)
prefetch debug: end of stream
lua debug: mediaklikk-video: Number of players: 1
lua debug: mediaklikk-video: Loading player: https://player.mediaklikk.hu/playernew/player.php?video=mtv4live
main debug: creating access: https://player.mediaklikk.hu/playernew/player.php?video=mtv4live
main debug: looking for access module matching "https": 24 candidates
main debug: looking for tls client module matching "any": 2 candidates
securetransport debug: open st client
main debug: using tls client module "securetransport"
main debug: resolving player.mediaklikk.hu ...
securetransport warning: Ignoring ALPN request due to lack of support in the backend. Proxy behavior potentially undefined.
securetransport debug: open TLS session for player.mediaklikk.hu
securetransport debug: handshake is blocked, try again later
securetransport debug: handshake is blocked, try again later
securetransport debug: handshake is blocked, try again later
securetransport debug: SSLHandshake returned errSSLServerAuthCompleted, continuing handshake
securetransport debug: handshake is blocked, try again later
securetransport debug: cerfificate verification successful, result is 4
securetransport debug: handshake completed successfully
http debug: outgoing request:
GET /playernew/player.php?video=mtv4live HTTP/1.1
Host: player.mediaklikk.hu
Accept: */*
Accept-Language: en_GB
User-Agent: VLC/3.0.17.3 LibVLC/3.0.17.3
Range: bytes=0-

http debug: incoming response:
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 22 Nov 2022 15:24:40 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Access-Control-Allow-Origin: *

main debug: using access module "access"
main debug: looking for stream_filter module matching "prefetch,cache_block": 26 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": 26 candidates
prefetch debug: end of stream
lua debug: Trying Lua scripts in /Users/adammakai/Library/Application Support/org.videolan.vlc/lua/playlist
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/lua/playlist
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/playlist
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_streams.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_xml.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/appletrailers.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/bbc_co_uk.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/cue.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/dailymotion.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/jamendo.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/koreus.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/liveleak.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mediaklikk-video.lua
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/newgrounds.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/rockbox_fm_presets.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/soundcloud.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/twitch.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/vimeo.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/vocaroo.luac
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube.luac
main debug: no stream_filter modules matched
lua warning: error running script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mediaklikk-video.lua: function parse(): ...package/macosx/../../../share/lua/modules/dkjson.lua:493: bad argument #1 to 'strfind' (string expected, got nil)
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 "prefetch"
main debug: removing module "access"
http debug: connection failed
securetransport debug: shutdown TLS session
securetransport debug: close TLS session
securetransport debug: close secure transport client
main debug: removing module "prefetch"
main debug: removing module "access"
securetransport debug: shutdown TLS session
securetransport debug: close TLS session
securetransport debug: close secure transport client
main debug: dead input
main debug: changing item without a request (current 0/1)
main debug: nothing to play
macosx debug: Playback has been ended
macosx debug: Releasing IOKit system sleep blocker (37586)

TLDR;

main debug: no stream_filter modules matched
lua warning: error running script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mediaklikk-video.lua: function parse(): ...package/macosx/../../../share/lua/modules/dkjson.lua:493: bad argument #1 to 'strfind' (string expected, got nil)
directory warning: unable to read directory

Do I need to install any 3rd party module?

tiborbaksa commented 1 year ago

Hi @makaivelli, thanks for reporting this issue, I can see the issue is the player's page doesn't seem to contain the JSON for the stream details. The root cause is the page checks the Referer header and returns an error page if the referrer is not set correctly.

I already developed a fix for this issue, just haven't released it because I wanted to test it more thoroughly. I just pushed it to the repo, could you try if it solves the issue?

tiborbaksa commented 1 year ago

I noticed M4 Sport currently returns multiple items in the playlist array (which is usually a single item). The script only adds the first one, so the actual stream is not added, only the preroll clip. I implemented a fix and also pushed it to the repo.

makaivelli commented 1 year ago

It does work, thanks a lot for the quick fix!