2bc4 / streamlink-ttvlol

Streamlink Twitch plugin modified to work with the TTV.LOL API
BSD 2-Clause "Simplified" License
180 stars 6 forks source link

twitch-proxy-playlist flag fails with comma list #26

Closed Bertaz closed 1 year ago

Bertaz commented 1 year ago

Streamlink parse twitch-proxy-playlist=https://api.ttv.lol,https://eu.luminous.dev,https://eu2.luminous.dev in %appdata%\streamlink\config.twitch as a single url without separating at commas Tried moving flag to general config file or escaping commas: x.com`,a.com\,b.com and "a.com,b.com"

Log: ``` [session][debug] Plugin twitch is being overridden by C:\Users\[User]\AppData\Roaming\streamlink\plugins\twitch.py [cli][debug] OS: Windows 10 [cli][debug] Python: 3.10.8 [cli][debug] Streamlink: 5.1.2 [cli][debug] Dependencies: [cli][debug] certifi: 2022.9.24 [cli][debug] isodate: 0.6.1 [cli][debug] lxml: 4.9.1 [cli][debug] pycountry: 22.3.5 [cli][debug] pycryptodome: 3.16.0 [cli][debug] PySocks: 1.7.1 [cli][debug] requests: 2.28.1 [cli][debug] urllib3: 1.26.13 [cli][debug] websocket-client: 1.4.2 [cli][debug] Arguments: [cli][debug] url=https://twitch.tv/[channel] [cli][debug] stream=['best'] [cli][debug] --loglevel=debug [cli][debug] --auto-version-check=True [cli][debug] --player="[installDir]\VideoLAN\VLC\vlc.exe" [cli][debug] --player-args=--play-and-exit --qt-minimal-view --file-caching=250 --network-caching=250 [cli][debug] --player-no-close=True [cli][debug] --title={author} - [{category}] - {{{title}}} [cli][debug] --stream-segment-threads=1 [cli][debug] --hls-live-edge=1 [cli][debug] --ffmpeg-ffmpeg=[installDir]\Streamlink\ffmpeg\ffmpeg.exe [cli][debug] --twitch-disable-ads=True [cli][debug] --twitch-low-latency=True [cli][debug] --twitch-api-header=[auth] [cli][debug] --twitch-proxy-playlist=https://api.ttv.lol,https://eu.luminous.dev,https://eu2.luminous.dev [cli][info] Found matching plugin twitch for URL https://twitch.tv/[channel] [plugins.twitch][debug] Getting live HLS streams for [channel] [plugins.twitch][info] Using playlist proxy 'https://api.ttv.lol,https://eu.luminous.dev,https://eu2.luminous.dev' [plugins.twitch][debug] Playlist proxy URL: https://api.ttv.lol%2Chttps://eu.luminous.dev%2Chttps://eu2.luminous.dev/playlist/[channel].m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue [utils.l10n][debug] Language code: en_US error: Unable to open URL: https://api.ttv.lol%2chttps//eu.luminous.dev%2Chttps://eu2.luminous.dev/playlist/[channel].m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (HTTPSConnectionPool(host='api.ttv.lol%2chttps', port=443): Max retries exceeded with url: //eu.luminous.dev%2Chttps://eu2.luminous.dev/playlist/[channel].m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))) ```

~Passing cli flag to streamlink works: streamlink https://twitch.tv/[channel] best --twitch-proxy-playlist=https://api.ttv.lol,https://eu.luminous.dev,https://eu2.luminous.dev~ Using both twitch-ttvlol and twitch-proxy-playlist comma list opens the stream as if only twitch-ttvlol was passed

Log: ``` [session][debug] Plugin twitch is being overridden by C:\Users\[User]\AppData\Roaming\streamlink\plugins\twitch.py [cli][debug] OS: Windows 10 [cli][debug] Python: 3.10.8 [cli][debug] Streamlink: 5.1.2 [cli][debug] Dependencies: [cli][debug] certifi: 2022.9.24 [cli][debug] isodate: 0.6.1 [cli][debug] lxml: 4.9.1 [cli][debug] pycountry: 22.3.5 [cli][debug] pycryptodome: 3.16.0 [cli][debug] PySocks: 1.7.1 [cli][debug] requests: 2.28.1 [cli][debug] urllib3: 1.26.13 [cli][debug] websocket-client: 1.4.2 [cli][debug] Arguments: [cli][debug] url=https://twitch.tv/[channel] [cli][debug] stream=['best'] [cli][debug] --loglevel=debug [cli][debug] --auto-version-check=True [cli][debug] --player="[installDir]\VideoLAN\VLC\vlc.exe" [cli][debug] --player-args=--play-and-exit --qt-minimal-view --file-caching=250 --network-caching=250 [cli][debug] --player-no-close=True [cli][debug] --title={author} - [{category}] - {{{title}}} [cli][debug] --stream-segment-threads=1 [cli][debug] --hls-live-edge=1 [cli][debug] --ffmpeg-ffmpeg=[installDir]\Streamlink\ffmpeg\ffmpeg.exe [cli][debug] --twitch-disable-ads=True [cli][debug] --twitch-low-latency=True [cli][debug] --twitch-api-header=[auth] [cli][debug] --twitch-proxy-playlist=https://api.ttv.lol,https://eu.luminous.dev,https://eu2.luminous.dev [cli][debug] --twitch-ttvlol=True [cli][info] Found matching plugin twitch for URL https://twitch.tv/[channel] [plugins.twitch][debug] Getting live HLS streams for [channel] [plugins.twitch][info] Using playlist proxy 'https://api.ttv.lol' [plugins.twitch][debug] Playlist proxy URL: https://api.ttv.lol/playlist/[channel].m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue [utils.l10n][debug] Language code: en_US [cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p60, 1080p60 (best) [cli][info] Opening stream: 1080p60 (hls) [cli][info] Starting player: "[installDir]\VideoLAN\VLC\vlc.exe" [plugins.twitch][info] Will skip ad segments [plugins.twitch][info] Low latency streaming (HLS live edge: 1) [stream.hls][debug] Reloading playlist [cli][debug] Pre-buffering 8192 bytes [stream.hls][debug] First Sequence: 17376; Last Sequence: 17391 [stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 17391; End Sequence: None [stream.hls][debug] Adding segment 17391 to queue [stream.hls][debug] Writing segment 17391 to output [cli.output][debug] Opening subprocess: "[installDir]\VideoLAN\VLC\vlc.exe" --input-title-format "[title]" --play-and-exit --qt-minimal-view --file-caching=250 --network-caching=250 - [cli][debug] Writing stream to output [stream.hls][debug] Reloading playlist [stream.hls][debug] Adding segment 17392 to queue [stream.hls][debug] Segment 17391 complete [stream.hls][debug] Writing segment 17392 to output [cli][info] Player closed [stream.segmented][debug] Closing worker thread [stream.segmented][debug] Closing writer thread [stream.hls][debug] Segment 17392 complete [cli][info] Stream ended [cli][info] Closing currently open stream... ```
Bertaz commented 1 year ago

I was wrong, cli and config file have the same effect. When I used cli I forgot I had the flag twitch-ttvlol in the config.

twitch-proxy-playlist with comma list only works with flag twitch-ttvlol set, probably because the latter overrides it and streamlink parse it as twitch-proxy-playlist=https://api.ttv.lol

2bc4 commented 1 year ago

If this is on the latest release this is definitely a bug however I can't reproduce it:

Log: ``` [session][debug] Plugin twitch is being overridden by C:\Users\User\AppData\Roaming\streamlink\plugins\twitch.py [cli][debug] OS: Windows 10 [cli][debug] Python: 3.11.1 [cli][debug] Streamlink: 5.1.2 [cli][debug] Dependencies: [cli][debug] certifi: 2022.12.7 [cli][debug] isodate: 0.6.1 [cli][debug] lxml: 4.9.2 [cli][debug] pycountry: 22.3.5 [cli][debug] pycryptodome: 3.16.0 [cli][debug] PySocks: 1.7.1 [cli][debug] requests: 2.28.1 [cli][debug] urllib3: 1.26.13 [cli][debug] websocket-client: 1.4.2 [cli][debug] Arguments: [cli][debug] url=twitch.tv/test [cli][debug] --loglevel=debug [cli][debug] --auto-version-check=True [cli][debug] --player-args=--play-and-exit --qt-minimal-view --file-caching=250 --network-caching=250 [cli][debug] --player-no-close=True [cli][debug] --title={author} - [{category}] - {{{title}} [cli][debug] --hls-live-edge=1 [cli][debug] --ffmpeg-ffmpeg=C:\Users\User\AppData\Local\Programs\Streamlink\ffmpeg\ffmpeg.exe [cli][debug] --twitch-disable-ads=True [cli][debug] --twitch-low-latency=True [cli][debug] --twitch-api-header=[('Authorization', 'OAuth [TOKEN]')] [cli][debug] --twitch-proxy-playlist=['https://api.ttv.lol', 'https://eu.luminous.dev', 'https://eu2.luminous.dev'] [cli][info] Found matching plugin twitch for URL twitch.tv/test [plugins.twitch][debug] Getting live HLS streams for test [plugins.twitch][info] Using playlist proxy 'https://api.ttv.lol' [plugins.twitch][debug] Playlist proxy URL: https://api.ttv.lol/playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue [utils.l10n][debug] Language code: en_US [plugins.twitch][warning] Unable to open URL: https://api.ttv.lol/playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (HTTPSConnectionPool(host='api.ttv.lol', port=443): Max retries exceeded with url: /playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))) [plugins.twitch][info] Using playlist proxy 'https://eu.luminous.dev' [plugins.twitch][debug] Playlist proxy URL: https://eu.luminous.dev/playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue [utils.l10n][debug] Language code: en_US [plugins.twitch][warning] Unable to open URL: https://eu.luminous.dev/playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (HTTPSConnectionPool(host='eu.luminous.dev', port=443): Max retries exceeded with url: /playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))) [plugins.twitch][info] Using playlist proxy 'https://eu2.luminous.dev' [plugins.twitch][debug] Playlist proxy URL: https://eu2.luminous.dev/playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue [utils.l10n][debug] Language code: en_US [plugins.twitch][warning] Unable to open URL: https://eu2.luminous.dev/playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (HTTPSConnectionPool(host='eu2.luminous.dev', port=443): Max retries exceeded with url: /playlist/test.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))) error: No proxies available ```

I tested on Linux, and Windows with the latest python3.11 build of Streamlink from: https://github.com/streamlink/windows-builds/releases

How did you install Streamlink so I can replicate?


twitch-proxy-playlist with comma list only works with flag twitch-ttvlol set, probably because the latter overrides it

Yes twitch-ttvlol does take priority over twitch-proxy-playlist, I decided to prioritize one of the flags instead of error out.

Bertaz commented 1 year ago

My fault, at some point during testing I restored the old version of the plugin without noticing. Everything works as expected. Sorry for the erroneous issue

Yes twitch-ttvlol does take priority over twitch-proxy-playlist, I decided to prioritize one of the flags instead of error out.

Makes sense