diff options
Diffstat (limited to 'gallery_dl/extractor/vipergirls.py')
| -rw-r--r-- | gallery_dl/extractor/vipergirls.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/gallery_dl/extractor/vipergirls.py b/gallery_dl/extractor/vipergirls.py index 1dd3482..e53ecf4 100644 --- a/gallery_dl/extractor/vipergirls.py +++ b/gallery_dl/extractor/vipergirls.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2023 Mike Fährmann +# Copyright 2023-2025 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -12,8 +12,6 @@ from .common import Extractor, Message from .. import text, util, exception from ..cache import cache -from xml.etree import ElementTree - BASE_PATTERN = r"(?:https?://)?(?:www\.)?vipergirls\.to" @@ -27,8 +25,7 @@ class VipergirlsExtractor(Extractor): cookies_names = ("vg_userid", "vg_password") def _init(self): - domain = self.config("domain") - if domain: + if domain := self.config("domain"): pos = domain.find("://") if pos >= 0: self.root = domain.rstrip("/") @@ -47,8 +44,7 @@ class VipergirlsExtractor(Extractor): forum_title = root[1].attrib["title"] thread_title = root[2].attrib["title"] - like = self.config("like") - if like: + if like := self.config("like"): user_hash = root[0].get("hash") if len(user_hash) < 16: self.log.warning("Login required to like posts") @@ -90,7 +86,7 @@ class VipergirlsExtractor(Extractor): def _login_impl(self, username, password): self.log.info("Logging in as %s", username) - url = "{}/login.php?do=login".format(self.root) + url = f"{self.root}/login.php?do=login" data = { "vb_login_username": username, "vb_login_password": password, @@ -129,8 +125,8 @@ class VipergirlsThreadExtractor(VipergirlsExtractor): self.thread_id, self.page = match.groups() def posts(self): - url = "{}/vr.php?t={}".format(self.root, self.thread_id) - return ElementTree.fromstring(self.request(url).text) + url = f"{self.root}/vr.php?t={self.thread_id}" + return self.request_xml(url) class VipergirlsPostExtractor(VipergirlsExtractor): @@ -146,5 +142,5 @@ class VipergirlsPostExtractor(VipergirlsExtractor): self.page = 0 def posts(self): - url = "{}/vr.php?p={}".format(self.root, self.post_id) - return ElementTree.fromstring(self.request(url).text) + url = f"{self.root}/vr.php?p={self.post_id}" + return self.request_xml(url) |
