Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update Stream string representation and refactor to_url + JSON data#4521

Merged
back-to merged 2 commits into
streamlink:masterfrom
bastimeyer:stream/string-representation
May 13, 2022
Merged

Update Stream string representation and refactor to_url + JSON data#4521
back-to merged 2 commits into
streamlink:masterfrom
bastimeyer:stream/string-representation

Conversation

@bastimeyer

Copy link
Copy Markdown
Member

Closes #4518

Not a perfect solution, but this should improve the Stream string representations a bit, as it now always includes the class name and shortname.

This PR also fixes a couple of bugs:

  1. One of the bugs was related to the JSON data of DASHStreams, which could raise errors if the URL was missing.
  2. Another bug was empty passthrough URLs not being handled correctly and it would start the player with an empty input argument.
  3. There were also some more bugs related to missing HTTP session headers and query params in the JSON data and URL return values. This is now resolved and tested appropriately.

The first commit was needed in order to clean up some of the to_url logic in HTTPStream, HLSStream and DASHStream.

- Move stream.http.valid_args to HTTPSession.valid_request_args
- Add HTTPSession.prepare_new_request
- Update HTTPStream
  - Use newly added HTTPSession methods
- Fix HLSStream
  - Prepare master URL appropriately
- Fix DASHStream
  - Return correct JSON data, depending whether manifest URL exists
  - Filter custom args in DASHStream.parse_manifest
- Use HTTPSession.prepare_new_request in plugins.twitch.UsherService
- Rewrite Stream JSON tests and move test module
- Change format of Stream string representations and error messages
  of `to_url` and `to_manifest_url`
- Don't override `__repr__` in `Stream` subclasses
- Raise TypeError if url or manifest URL is None
- Fix CLI
  - Abort passthrough if stream can't be translated to URL
  - Remove unneeded streamlink_cli.utils.stream module
- Rewrite stream URL tests
- Move FilmOnHLS stream URL tests to plugin test module (and rewrite)
@bastimeyer bastimeyer force-pushed the stream/string-representation branch from 9791623 to 51bd393 Compare May 10, 2022 07:15
@back-to back-to merged commit ecb21f9 into streamlink:master May 13, 2022
@bastimeyer bastimeyer deleted the stream/string-representation branch May 13, 2022 19:09
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
…4521)

plugin.api.http_session: add prepare_new_request
- Move stream.http.valid_args to HTTPSession.valid_request_args
- Add HTTPSession.prepare_new_request
- Update HTTPStream
  - Use newly added HTTPSession methods
- Fix HLSStream
  - Prepare master URL appropriately
- Fix DASHStream
  - Return correct JSON data, depending whether manifest URL exists
  - Filter custom args in DASHStream.parse_manifest
- Use HTTPSession.prepare_new_request in plugins.twitch.UsherService
- Rewrite Stream JSON tests and move test module
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
…#4521)

- Change format of Stream string representations and error messages
  of `to_url` and `to_manifest_url`
- Don't override `__repr__` in `Stream` subclasses
- Raise TypeError if url or manifest URL is None
- Fix CLI
  - Abort passthrough if stream can't be translated to URL
  - Remove unneeded streamlink_cli.utils.stream module
- Rewrite stream URL tests
- Move FilmOnHLS stream URL tests to plugin test module (and rewrite)
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
…4521)

plugin.api.http_session: add prepare_new_request
- Move stream.http.valid_args to HTTPSession.valid_request_args
- Add HTTPSession.prepare_new_request
- Update HTTPStream
  - Use newly added HTTPSession methods
- Fix HLSStream
  - Prepare master URL appropriately
- Fix DASHStream
  - Return correct JSON data, depending whether manifest URL exists
  - Filter custom args in DASHStream.parse_manifest
- Use HTTPSession.prepare_new_request in plugins.twitch.UsherService
- Rewrite Stream JSON tests and move test module
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2022
…#4521)

- Change format of Stream string representations and error messages
  of `to_url` and `to_manifest_url`
- Don't override `__repr__` in `Stream` subclasses
- Raise TypeError if url or manifest URL is None
- Fix CLI
  - Abort passthrough if stream can't be translated to URL
  - Remove unneeded streamlink_cli.utils.stream module
- Rewrite stream URL tests
- Move FilmOnHLS stream URL tests to plugin test module (and rewrite)
snorkelopstesting3-bot pushed a commit to snorkel-marlin-repos/streamlink_streamlink_pr_4521_c38058fc-c202-4283-b4d7-47cd8a2673aa that referenced this pull request Oct 22, 2025
snorkelopstesting4-web added a commit to snorkel-marlin-repos/streamlink_streamlink_pr_4521_c38058fc-c202-4283-b4d7-47cd8a2673aa that referenced this pull request Oct 22, 2025
…or to_url + JSON data

Merged from original PR #4521
Original: streamlink/streamlink#4521
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stream string representations should be improved

2 participants