-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
plugin: new matchers API #3821
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
Merged
Merged
plugin: new matchers API #3821
Conversation
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
8e7ad26
to
9709153
Compare
- drop `Plugin.can_handle_url` and `Plugin.priority` - introduce `Plugin.matchers` - implement `pluginmatcher` decorator - automatically match url (on change) and store result - update `Session.resolve_url` - add and fix related tests
9709153
to
5ede455
Compare
I've replaced Documentation still needs to be written, but that can be done later on to make things not more complicated here. |
- update protocol plugins: akamaihd, dash, hds, hls, http and rtmp - remove `plugin.parse_url_params`, update `plugin.parse_params` - refactor DASH tests
Basic plugins do only have one URL regex, don't reference capture groups, don't translate URLs and their `can_handle_url` is simple. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Plugins with only one URL regex which reference capture groups, but don't translate URLs and their `can_handle_url` is simple. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Update plugins which have specific checks in their `can_handle_url` classmethod. Make those plugins return no streams instead when the specific checks would have returned False otherwise. Also update plugins calling other plugins' `can_handle_url`. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Plugins that use more than one URL matcher pattern. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Resolve deprecated plugins which are using the old `can_handle_url(url)` and `priority(url)` methods. Since the `Plugin` class doesn't implement the `priority` classmethod with the NORMAL_PRIORITY return value anymore, the NORMAL_PRIORITY gets set by the resolver if the method is missing on plugins which implement `can_handle_url` and don't have the `matchers` list.
5ede455
to
e2ca35b
Compare
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
- drop `Plugin.can_handle_url` and `Plugin.priority` - introduce `Plugin.matchers` - implement `pluginmatcher` decorator - automatically match url (on change) and store result - update `Session.resolve_url` - add and fix related tests
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
- update protocol plugins: akamaihd, dash, hds, hls, http and rtmp - remove `plugin.parse_url_params`, update `plugin.parse_params` - refactor DASH tests
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
Basic plugins do only have one URL regex, don't reference capture groups, don't translate URLs and their `can_handle_url` is simple. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
) Plugins with only one URL regex which reference capture groups, but don't translate URLs and their `can_handle_url` is simple. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
…#3821) Update plugins which have specific checks in their `can_handle_url` classmethod. Make those plugins return no streams instead when the specific checks would have returned False otherwise. Also update plugins calling other plugins' `can_handle_url`. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
…k#3821) Plugins that use more than one URL matcher pattern. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
Resolve deprecated plugins which are using the old `can_handle_url(url)` and `priority(url)` methods. Since the `Plugin` class doesn't implement the `priority` classmethod with the NORMAL_PRIORITY return value anymore, the NORMAL_PRIORITY gets set by the resolver if the method is missing on plugins which implement `can_handle_url` and don't have the `matchers` list.
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
) Plugins with only one URL regex which reference capture groups, but don't translate URLs and their `can_handle_url` is simple. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
…#3821) Update plugins which have specific checks in their `can_handle_url` classmethod. Make those plugins return no streams instead when the specific checks would have returned False otherwise. Also update plugins calling other plugins' `can_handle_url`. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
…k#3821) Plugins that use more than one URL matcher pattern. Update and fix URL regex patterns: - remove unnecessary anchors and optional trailing wildcards - optionally match https (scheme update is plugin responsibility) - escape actual dots in hostnames and path file extensions - fix subdomain (non-)capture groups (don't match anything) - fix unnecessarily escaped characters - simplify character sets - improve readability (verbose and non-verbose patterns)
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
Billy2011
added a commit
to Billy2011/streamlink-27
that referenced
this pull request
Jul 1, 2021
Resolve deprecated plugins which are using the old `can_handle_url(url)` and `priority(url)` methods. Since the `Plugin` class doesn't implement the `priority` classmethod with the NORMAL_PRIORITY return value anymore, the NORMAL_PRIORITY gets set by the resolver if the method is missing on plugins which implement `can_handle_url` and don't have the `matchers` list.
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.
Opening this as a draft, see #3814.
The interesting commits are the first two and the last one, the rest are plugin updates, which are not that interesting and bloat up this diff a lot.
I've split up the plugin changes into multiple commits, based on the type of changes. Since the URL regexes had to be moved, I immediately applied fixes, as it would be duplicate work otherwise.
I'm not sure if I'm convinced with the regex pattern compilation in the decorator and the language injection annotations. After thinking about it again, it's probably better to just call
re.compile
in the decorator patameter.Apart from that, the only thing that's missing is documentation.