Skip to content

plugins.ltv_lsm_lv: fix plugin, rm LTVHLSStream #5858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

bastimeyer
Copy link
Member

Fixes #5857

Two issues:

  1. The site has changed and the embedded player ID can't be extracted separately anymore, so the whole embedded player URL needs to be found instead
  2. The plugin's custom HLSStreamWorker subclass was not updated after some changes were made in the base class, resulting in an incompatible signature of LTVHLSStreamWorker.process_segments() (probably the reason why @karlis-vagalis was using the --stream-url parameter)

@karlis-vagalis please check and verify these plugin fixes using a couple of different stream URLs, as the live content is geo-blocked for me and it's only listing replays/VODs on their site. Please include a short debug log (without --stream-url), thanks.
https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#pull-request-feedback

I also have no idea if the custom HLSStream implementation is even necessary anymore. The streams apparently are working fine without it, but I can't say that this is the case for every stream on their site. --stream-url completely bypasses Streamlink's HLS implementation, including the plugin's custom subclass of course, so if the streams have been working previously using that CLI parameter, then that would suggest that the custom HLS implementation with the playlist+segment URL query string overrides is indeed unnecessary.

$ streamlink -l debug 'https://ltv.lsm.lv/lv/tiesraide/ltv1' best
[cli][debug] OS:         Linux-6.7.6-1-git-x86_64-with-glibc2.39
[cli][debug] Python:     3.12.2
[cli][debug] OpenSSL:    OpenSSL 3.2.1 30 Jan 2024
[cli][debug] Streamlink: 6.6.2+1.g6f09f947
[cli][debug] Dependencies:
[cli][debug]  certifi: 2024.2.2
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 5.1.0
[cli][debug]  pycountry: 23.12.11
[cli][debug]  pycryptodome: 3.20.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.24.0
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  typing-extensions: 4.9.0
[cli][debug]  urllib3: 2.2.1
[cli][debug]  websocket-client: 1.7.0
[cli][debug] Arguments:
[cli][debug]  url=https://ltv.lsm.lv/lv/tiesraide/ltv1
[cli][debug]  stream=['best']
[cli][debug]  --loglevel=debug
[cli][debug]  --player=/usr/bin/mpv
[cli][info] Found matching plugin ltv_lsm_lv for URL https://ltv.lsm.lv/lv/tiesraide/ltv1
[plugins.ltv_lsm_lv][debug] Found channel ID: x44_ltv06-ltv1-g
[utils.l10n][debug] Language code: en_US
[cli][info] Available streams: 360p (worst), 720p, 1080p (best)
[cli][info] Opening stream: 1080p (hls)
[cli][info] Starting player: /usr/bin/mpv
[stream.hls][debug] Reloading playlist
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] First Sequence: 77130; Last Sequence: 77134
[stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 77132; End Sequence: None
[stream.hls][debug] Adding segment 77132 to queue
[stream.hls][debug] Adding segment 77133 to queue
[stream.hls][debug] Adding segment 77134 to queue
[stream.hls][debug] Writing segment 77132 to output
[stream.hls][debug] Segment 77132 complete
[cli.output][debug] Opening subprocess: ['/usr/bin/mpv', '--force-media-title=https://ltv.lsm.lv/lv/tiesraide/ltv1', '-']
[stream.hls][debug] Writing segment 77133 to output
[stream.hls][debug] Segment 77133 complete
[stream.hls][debug] Writing segment 77134 to output
[stream.hls][debug] Segment 77134 complete
[cli][debug] Writing stream to output
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 77135 to queue
[stream.hls][debug] Writing segment 77135 to output
[stream.hls][debug] Segment 77135 complete
[stream.hls][debug] Reloading playlist
...
[cli][info] Player closed
[stream.segmented][debug] Closing worker thread
[stream.segmented][debug] Closing writer thread
[cli][info] Stream ended
[cli][info] Closing currently open stream...

@bastimeyer bastimeyer added plugin issue A Plugin does not work correctly restriction: geo blocked labels Feb 24, 2024
- Fix embedded player iframe validation schema
- Update pluginmatcher
- Remove unneeded HLSStream subclass
@bastimeyer bastimeyer force-pushed the plugins/ltvlsmlv/fix-iframe-and-hls-stream branch from 6f09f94 to 1483e44 Compare February 24, 2024 10:33
@bastimeyer
Copy link
Member Author

Force-pushed with an update of the plugin matcher (replay support), and also removed the custom HLSStream subclass.

As said, live streams are geo-blocked for me and show a warning message stream instead, so it's possible that the actual live streams still require the custom HLSStream implementation.

$ ./script/test-plugin-urls.py ltv_lsm_lv
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/lr1
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/lr2
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/lr3
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/lr4
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/lr5
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/lr6
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/ltv1
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/ltv7
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://ltv.lsm.lv/lv/tiesraide/visiem
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://replay.lsm.lv/lv/tiesraide/ltv7/sporta-studija-aizkulises
:: Found streams: 360p, 720p, 1080p, worst, best
:: Finding streams for URL: https://replay.lsm.lv/ru/efir/ltv7/sporta-studija-aizkulises
:: Found streams: 360p, 720p, 1080p, worst, best

@karlis-vagalis
Copy link

Thanks for the super quick fix. This did indeed solve the issue.

Log (using proxy for geo block):

$ streamlink -l debug --http-proxy 'http://192.168.2.50:23001' 'https://ltv.lsm.lv/lv/tiesraide/ltv1' best
[session][debug] Loading plugin: ltv_lsm_lv
[cli][debug] OS:         Linux-6.7.5-arch1-1-x86_64-with-glibc2.39
[cli][debug] Python:     3.11.7
[cli][debug] OpenSSL:    OpenSSL 3.2.1 30 Jan 2024
[cli][debug] Streamlink: 6.6.1+8.g1483e44a
[cli][debug] Dependencies:
[cli][debug]  certifi: 2024.2.2
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 5.1.0
[cli][debug]  pycountry: 23.12.11
[cli][debug]  pycryptodome: 3.20.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.24.0
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  typing-extensions: 4.9.0
[cli][debug]  urllib3: 2.2.1
[cli][debug]  websocket-client: 1.7.0
[cli][debug] Arguments:
[cli][debug]  url=https://ltv.lsm.lv/lv/tiesraide/ltv1
[cli][debug]  stream=['best']
[cli][debug]  --loglevel=debug
[cli][debug]  --http-proxy=http://192.168.2.50:23001
[cli][info] Found matching plugin ltv_lsm_lv for URL https://ltv.lsm.lv/lv/tiesraide/ltv1
[plugins.ltv_lsm_lv][debug] Found channel ID: 9xz_ltv1-lv-srt
[utils.l10n][debug] Language code: en_US
[stream.ffmpegmux][debug] ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
[stream.ffmpegmux][debug]  built with gcc 13.2.1 (GCC) 20230801
[stream.ffmpegmux][debug]  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
[stream.ffmpegmux][debug]  libavutil      58. 29.100 / 58. 29.100
[stream.ffmpegmux][debug]  libavcodec     60. 31.102 / 60. 31.102
[stream.ffmpegmux][debug]  libavformat    60. 16.100 / 60. 16.100
[stream.ffmpegmux][debug]  libavdevice    60.  3.100 / 60.  3.100
[stream.ffmpegmux][debug]  libavfilter     9. 12.100 /  9. 12.100
[stream.ffmpegmux][debug]  libswscale      7.  5.100 /  7.  5.100
[stream.ffmpegmux][debug]  libswresample   4. 12.100 /  4. 12.100
[stream.ffmpegmux][debug]  libpostproc    57.  3.100 / 57.  3.100
[stream.hls][debug] Using external audio tracks for stream 1080p (language=lav, name=Latviešu)
[stream.hls][debug] Using external audio tracks for stream 720p (language=lav, name=Latviešu)
[stream.hls][debug] Using external audio tracks for stream 360p (language=lav, name=Latviešu)
[cli][info] Available streams: 360p (worst), 720p, 1080p (best)
[cli][info] Opening stream: 1080p (hls-multi)
[cli][info] Starting player: /usr/bin/vlc
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[utils.named_pipe][info] Creating pipe streamlinkpipe-16073-1-9264
[utils.named_pipe][info] Creating pipe streamlinkpipe-16073-2-7207
[stream.ffmpegmux][debug] ffmpeg command: /usr/bin/ffmpeg -nostats -y -i /tmp/streamlinkpipe-16073-1-9264 -i /tmp/streamlinkpipe-16073-2-7207 -c:v copy -c:a copy -map 0:v? -map 0:a? -map 1:a -f mpegts pipe:1
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/streamlinkpipe-16073-1-9264
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/streamlinkpipe-16073-2-7207
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] First Sequence: 194892; Last Sequence: 194896
[stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 194894; End Sequence: None
[stream.hls][debug] Adding segment 194894 to queue
[stream.hls][debug] Adding segment 194895 to queue
[stream.hls][debug] Adding segment 194896 to queue
[stream.hls][debug] First Sequence: 194892; Last Sequence: 194896
[stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 194894; End Sequence: None
[stream.hls][debug] Adding segment 194894 to queue
[stream.hls][debug] Adding segment 194895 to queue
[stream.hls][debug] Adding segment 194896 to queue
[stream.hls][debug] Writing segment 194894 to output
[stream.hls][debug] Segment 194894 complete
[stream.hls][debug] Writing segment 194895 to output
[stream.hls][debug] Segment 194895 complete
[stream.hls][debug] Writing segment 194896 to output
[stream.hls][debug] Segment 194896 complete
[stream.hls][debug] Writing segment 194894 to output
[stream.hls][debug] Segment 194894 complete
[stream.hls][debug] Writing segment 194895 to output
[stream.hls][debug] Segment 194895 complete
[cli.output][debug] Opening subprocess: ['/usr/bin/vlc', '--input-title-format', 'https://ltv.lsm.lv/lv/tiesraide/ltv1', '-']
[cli][debug] Writing stream to output
[stream.hls][debug] Writing segment 194896 to output
[stream.hls][debug] Segment 194896 complete
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 194897 to queue
[stream.hls][debug] Adding segment 194897 to queue
[stream.hls][debug] Writing segment 194897 to output
[stream.hls][debug] Segment 194897 complete
[stream.hls][debug] Writing segment 194897 to output
[stream.hls][debug] Segment 194897 complete
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 194898 to queue
[stream.hls][debug] Adding segment 194898 to queue
[stream.hls][debug] Writing segment 194898 to output
[stream.hls][debug] Segment 194898 complete
[stream.hls][debug] Writing segment 194898 to output
[stream.hls][debug] Segment 194898 complete
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 194899 to queue
[stream.hls][debug] Adding segment 194899 to queue
[stream.hls][debug] Writing segment 194899 to output
[stream.hls][debug] Segment 194899 complete
[stream.hls][debug] Writing segment 194899 to output
[stream.hls][debug] Segment 194899 complete
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 194900 to queue
[stream.hls][debug] Adding segment 194900 to queue
[stream.hls][debug] Writing segment 194900 to output
[stream.hls][debug] Segment 194900 complete
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 194901 to queue
[stream.hls][debug] Adding segment 194901 to queue
[stream.hls][debug] Writing segment 194901 to output
[stream.hls][debug] Segment 194901 complete
[stream.hls][debug] Writing segment 194900 to output
[stream.hls][debug] Segment 194900 complete
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 194902 to queue
[stream.hls][debug] Adding segment 194902 to queue
[stream.hls][debug] Writing segment 194902 to output
[stream.hls][debug] Segment 194902 complete
[stream.hls][debug] Writing segment 194901 to output
[stream.hls][debug] Segment 194901 complete
^C[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.segmented][debug] Closing worker thread
[stream.segmented][debug] Closing writer thread
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/streamlinkpipe-16073-1-9264
[stream.segmented][debug] Closing worker thread
[stream.segmented][debug] Closing writer thread
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/streamlinkpipe-16073-2-7207
[stream.ffmpegmux][debug] Closed all the substreams
[cli][info] Stream ended
Interrupted! Exiting...
[cli][info] Closing currently open stream...

@bastimeyer bastimeyer changed the title plugins.ltv_lsm_lv: fix iframe schema + HLSStream plugins.ltv_lsm_lv: fix plugin, rm LTVHLSStream Feb 24, 2024
@bastimeyer bastimeyer merged commit ef25765 into streamlink:master Feb 24, 2024
@bastimeyer bastimeyer deleted the plugins/ltvlsmlv/fix-iframe-and-hls-stream branch February 24, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly restriction: geo blocked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugins.ltv_lsm_lv: No playable streams found on this URL
2 participants