stream.hls: handle exception StreamError in Thread-HLSStreamWorker - iter_segments#3903
Merged
Merged
Conversation
…iter_segments Streamlink can crash with `streamlink.exceptions.StreamError` since streamlink@193c5c6 --- Test URL https://gist.githubusercontent.com/back-to/514946aad6ce17586d992d05ee42673c/raw/521fe8dd25200042c71f1756b3f61cdd66093a8d/hlsva.m3u8 --- streamlink 2.2.0 ``` [cli][debug] Streamlink: 2.2.0 [cli][info] Found matching plugin hls for URL hlsva.m3u8 [cli][info] Available streams: 180p (worst, best) [cli][info] Opening stream: 180p (hls) [cli][error] Try 1/1: Could not open stream <HLSStream('test_1.m3u8', 'hlsva.m3u8')> (Could not open stream: Attempted to play a variant playlist, use 'hls://test_1.m3u8' instead) error: Could not open stream <HLSStream('test_1.m3u8', 'hlsva.m3u8')>, tried 1 times, exiting ``` streamlink 2.3.0 ``` [cli][debug] Streamlink: 2.3.0 [cli][info] Found matching plugin hls for URL hlsva.m3u8 [cli][info] Available streams: 180p (worst, best) [cli][info] Opening stream: 180p (hls) [stream.hls][debug] Reloading playlist [cli][debug] Pre-buffering 8192 bytes Exception in thread Thread-HLSStreamWorker: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner self.run() File "src/streamlink/stream/segmented.py", line 84, in run for segment in self.iter_segments(): File "src/streamlink/stream/hls.py", line 325, in iter_segments self.reload_playlist() File "src/streamlink/stream/hls.py", line 253, in reload_playlist raise StreamError("Attempted to play a variant playlist, use " streamlink.exceptions.StreamError: Attempted to play a variant playlist, use 'hls://test_1.m3u8' instead [stream.segmented][debug] Closing worker thread [stream.segmented][debug] Closing writer thread [cli][error] Try 1/1: Could not open stream <HLSStream('test_1.m3u8', 'hlsva.m3u8')> (Failed to read data from stream: Read timeout) error: Could not open stream <HLSStream('test_1.m3u8', 'hlsva.m3u8')>, tried 1 times, exiting [cli][info] Closing currently open stream... ``` After PR ``` [cli][debug] Streamlink: 2.3.0+4.gc3f390a.dirty [cli][info] Found matching plugin hls for URL hlsva.m3u8 [cli][info] Available streams: 180p (worst, best) [cli][info] Opening stream: 180p (hls) [stream.hls][debug] Reloading playlist [cli][debug] Pre-buffering 8192 bytes [stream.hls][error] Attempted to play a variant playlist, use 'hls://test_1.m3u8' instead [stream.segmented][debug] Closing worker thread [stream.segmented][debug] Closing writer thread [cli][error] Try 1/1: Could not open stream <HLSStream('test_1.m3u8', 'hlsva.m3u8')> (No data returned from stream) error: Could not open stream <HLSStream('test_1.m3u8', 'hlsva.m3u8')>, tried 1 times, exiting [cli][info] Closing currently open stream... ``` ``` streamlink https://www.raiplay.it/dirette/raiyoyo [cli][debug] Streamlink: 2.3.0+4.gc3f390a.dirty [cli][info] Found matching plugin raiplay for URL https://www.raiplay.it/dirette/raiyoyo [plugins.raiplay][debug] Found JSON URL: https://www.raiplay.it/dirette/raiyoyo.json [plugins.raiplay][debug] Found stream URL: https://mediapolis.rai.it/relinker/relinkerServlet.htm?cont=746899 [utils.l10n][debug] Language code: en_US [cli][info] Available streams: 396p (worst), 504p, 576p (best) [cli][info] Opening stream: 576p (hls) [stream.hls][debug] Reloading playlist [cli][debug] Pre-buffering 8192 bytes [stream.hls][error] Unable to open URL: ... (403 Client Error: Forbidden for url: ...) [stream.segmented][debug] Closing worker thread [stream.segmented][debug] Closing writer thread [cli][error] Try 1/1: Could not open stream <HLSStream('...', '...')> (No data returned from stream) error: Could not open stream <HLSStream('...', '...')>, tried 1 times, exiting [cli][info] Closing currently open stream... ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Streamlink can crash with
streamlink.exceptions.StreamErrorsince193c5c6
Test URL
https://gist.githubusercontent.com/back-to/514946aad6ce17586d992d05ee42673c/raw/521fe8dd25200042c71f1756b3f61cdd66093a8d/hlsva.m3u8
streamlink 2.2.0
streamlink 2.3.0
Ref #3895
After PR
Ref #3895 (comment) for error 1