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

Skip to content

plugins: fix broken matcher capture groups#6368

Merged
bastimeyer merged 1 commit into
streamlink:masterfrom
bastimeyer:plugins/fix-matcher-regex-groups
Dec 30, 2024
Merged

plugins: fix broken matcher capture groups#6368
bastimeyer merged 1 commit into
streamlink:masterfrom
bastimeyer:plugins/fix-matcher-regex-groups

Conversation

@bastimeyer

@bastimeyer bastimeyer commented Dec 30, 2024

Copy link
Copy Markdown
Member

Verbose plugin matcher regexes of some plugins were split into multiple simple matchers in 742988f.

Some regex capture group references however were not updated, resulting in IndexError being raised.


Fixes #6366
See #6363, #6364

Here's the list of all updated plugins in 742988f and their current number of @pluginmatchers, with all self.match/self.matches references (for accessing matchers and their regex capture groups).

$ for file in (git show --format="" --name-only 742988f2d57f1807bea2210a1d721c632c1d7b75 -- src/); echo $file; grep -c -F '@pluginmatcher' $file; grep -F 'self.match' $file; echo; end
src/streamlink/plugins/abematv.py
3
        if self.matches["onair"]:
            onair = self.match["onair"]
        elif self.matches["episode"]:
            episode = self.match["episode"]
        elif self.matches["slots"]:
            slots = self.match["slots"]

src/streamlink/plugins/adultswim.py
1
        url_type, show_name, episode_name = self.match.groups()

src/streamlink/plugins/albavision.py
13

src/streamlink/plugins/ard_mediathek.py
2
                self._URL_API.format(item=self.match["id_live"] if self.matches["live"] else self.match["id_video"]),

src/streamlink/plugins/bbciplayer.py
2
        if self.matches["episode"]:
            episode_id = self.match["episode_id"]
        elif self.matches["live"]:
            channel_name = self.match["channel_name"]

src/streamlink/plugins/cdnbg.py
8

src/streamlink/plugins/cinergroup.py
5

src/streamlink/plugins/dailymotion.py
2
        if self.matches["user"]:
            media_id = self._get_media_id(self.match["user"])
            media_id = self.match["media_id"]

src/streamlink/plugins/mediavitrina.py
4

src/streamlink/plugins/picarto.py
4
        m = self.match.groupdict()

src/streamlink/plugins/streann.py
6
        if not self.matches["streann"]:

src/streamlink/plugins/swisstxt.py
1
        site = self.match.group(1) or self.match.group(2)

src/streamlink/plugins/tf1.py
3
        if self.matches["live"]:
            channel = self.match["live"]
        elif self.matches["stream"]:
            channel = self.match["stream"]
        elif self.matches["lci"]:

src/streamlink/plugins/trovo.py
1
        url_data = self.match.groupdict()

src/streamlink/plugins/turkuvaz.py
9

src/streamlink/plugins/tv4play.py
2
            self.video_id = self.match.group("video_id")

Plugins with only one matcher, or plugins which don't look up regex capture groups could be ignored. Other ones had to be investigated.

  • abematv.py (fixed via self.matches check)
  • adultswim.py (single matcher)
  • albavision.py (no capture groups)
  • ard_mediathek.py (fixed via self.matches check)
  • bbciplayer.py (fixed via self.matches check)
  • cdnbg.py (no capture groups)
  • cinergroup.py (no capture groups)
  • dailymotion.py (fixed in earlier commit)
  • mediavitrina.py (no capture groups)
  • picarto.py (fixed by accessing dict.get())
  • streann.py (fixed incorrect matcher id/name)
  • swisstxt.py (single matcher)
  • tf1.py (was already fixed)
  • trovo.py (single matcher)
  • turkuvaz.py (no capture groups)
  • tv4play.py (both matcher regexes have the same group name)

Verbose plugin matcher regexes of some plugins were split into
multiple simple matchers in 742988f.

Some regex capture group references however were not updated,
resulting in `IndexError` being raised.
@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Dec 30, 2024
@bastimeyer bastimeyer merged commit 794d96d into streamlink:master Dec 30, 2024
@bastimeyer bastimeyer deleted the plugins/fix-matcher-regex-groups branch December 30, 2024 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin issue A Plugin does not work correctly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plugins.abematv: URL matching broken

1 participant