diff options
| author | 2025-07-31 01:22:01 -0400 | |
|---|---|---|
| committer | 2025-07-31 01:22:01 -0400 | |
| commit | a6e995c093de8aae2e91a0787281bb34c0b871eb (patch) | |
| tree | 2d79821b05300d34d8871eb6c9662b359a2de85d /gallery_dl/extractor/postmill.py | |
| parent | 7672a750cb74bf31e21d76aad2776367fd476155 (diff) | |
New upstream version 1.30.2.upstream/1.30.2
Diffstat (limited to 'gallery_dl/extractor/postmill.py')
| -rw-r--r-- | gallery_dl/extractor/postmill.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/gallery_dl/extractor/postmill.py b/gallery_dl/extractor/postmill.py index 6ea18e6..af971ab 100644 --- a/gallery_dl/extractor/postmill.py +++ b/gallery_dl/extractor/postmill.py @@ -6,9 +6,8 @@ """Extractors for Postmill instances""" -import re from .common import BaseExtractor, Message -from .. import text, exception +from .. import text, util, exception class PostmillExtractor(BaseExtractor): @@ -21,8 +20,8 @@ class PostmillExtractor(BaseExtractor): def _init(self): self.instance = self.root.partition("://")[2] self.save_link_post_body = self.config("save-link-post-body", False) - self._search_canonical_url = re.compile(r"/f/([\w\d_]+)/(\d+)/").search - self._search_image_tag = re.compile( + self._search_canonical_url = util.re(r"/f/([\w\d_]+)/(\d+)/").search + self._search_image_tag = util.re( r'<a href="[^"]+"\n +class="submission__image-link"').search def items(self): @@ -47,8 +46,8 @@ class PostmillExtractor(BaseExtractor): '</div>') match = self._search_canonical_url(post_canonical_url) - forum = match.group(1) - id = int(match.group(2)) + forum = match[1] + id = int(match[2]) is_text_post = (url[0] == "/") is_image_post = self._search_image_tag(page) is not None @@ -103,8 +102,8 @@ class PostmillSubmissionsExtractor(PostmillExtractor): if response.history: redirect_url = response.url if redirect_url == self.root + "/login": - raise exception.StopExtraction( - "HTTP redirect to login page (%s)", redirect_url) + raise exception.AbortExtraction( + f"HTTP redirect to login page ({redirect_url})") page = response.text for nav in text.extract_iter(page, @@ -143,8 +142,8 @@ class PostmillPostExtractor(PostmillExtractor): def __init__(self, match): PostmillExtractor.__init__(self, match) - self.forum = match.group(3) - self.post_id = match.group(4) + self.forum = match[3] + self.post_id = match[4] def post_urls(self): return (self.root + "/f/" + self.forum + "/" + self.post_id,) |
