'match.group(N)' -> 'match[N]' (#7671)

2.5x faster
This commit is contained in:
Mike Fährmann
2025-06-18 12:59:37 +02:00
parent 475506cc39
commit 41191bb60a
135 changed files with 363 additions and 363 deletions

View File

@@ -141,7 +141,7 @@ class RedditExtractor(Extractor):
match = match_submission(url)
if match:
extra.append(match.group(1))
extra.append(match[1])
elif not match_user(url) and not match_subreddit(url):
if previews and "comment" not in data and \
"preview" in data:
@@ -309,7 +309,7 @@ class RedditSubmissionExtractor(RedditExtractor):
def __init__(self, match):
RedditExtractor.__init__(self, match)
self.submission_id = match.group(1)
self.submission_id = match[1]
def submissions(self):
return (self.api.submission(self.submission_id),)
@@ -326,14 +326,14 @@ class RedditImageExtractor(Extractor):
def __init__(self, match):
Extractor.__init__(self, match)
domain = match.group(1)
self.path = match.group(2)
domain = match[1]
self.path = match[2]
if domain == "preview.redd.it":
self.domain = "i.redd.it"
self.query = ""
else:
self.domain = domain
self.query = match.group(3) or ""
self.query = match[3] or ""
def items(self):
url = "https://{}/{}{}".format(self.domain, self.path, self.query)