Skip to content

Conversation

@bastimeyer
Copy link
Member

  • Split up verbose pluginmatcher regexes into multiple matchers with non-verbose regexes, or translate unnecessary verbose regexes into non-verbose ones, but keep verbose pluginmatcher regexes where it makes sense
  • Update plugin logic and refer to the matcher name instead of the capture group name where it makes sense
  • Optimize regexes in certain cases, based on URL data from tests
  • Update tests accordingly

The motivation for this change is the addition of a --show-pluginmatchers / --show-matchers CLI argument, which could list the matchers of a specific plugin (or all plugins), which allows users to check why an input URL might not have matched.

As mentioned in the commit message body, I rewrote some regexes, so there's potential for mistakes here. Albavision is one of those plugins, whose regex tries to match lots of hostnames and then all potential URL paths accross all sites.

In regards to capture group names, those were not changed, so no plugin logic had to be touched. One exception is the tf1 plugin, which now refers to the name of the matched pluginmatcher instead of the capture group. This probably could've been done in other plugins too, but I didn't want to spend any time on this.

Yes, adding more plugin matchers instead of having just one big verbose regex is bad performance-wise, but this is totally insignificant. Verbose "catch-all" regexes are bad legibility/maintainability-wise and are bad for a CLI arg as mentioned above.


I will have another look at the diff later before merging...

- Split up verbose pluginmatcher regexes into multiple matchers
  with non-verbose regexes, or translate unnecessary verbose regexes
  into non-verbose ones, but keep verbose pluginmatcher regexes
  where it makes sense
- Update plugin logic and refer to the matcher name instead of
  the capture group name where it makes sense
- Optimize regexes in certain cases, based on URL data from tests
- Update tests accordingly
@bastimeyer bastimeyer merged commit 742988f into streamlink:master Nov 11, 2024
@bastimeyer bastimeyer deleted the plugins/verbose-matcher-regexes branch November 11, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant