summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/booru.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-11-22 04:28:38 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2022-11-22 04:28:38 -0500
commit7af5cc29d1c02d20a6890b7b7ba78ab41532a763 (patch)
tree4f0366e5653074c7eb31ac7ca59a1ee55f2d736e /gallery_dl/extractor/booru.py
parente59d46ecda74190381b1d2725b0bd9df5c0be8d8 (diff)
New upstream version 1.24.0.upstream/1.24.0
Diffstat (limited to 'gallery_dl/extractor/booru.py')
-rw-r--r--gallery_dl/extractor/booru.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/gallery_dl/extractor/booru.py b/gallery_dl/extractor/booru.py
index 12d98b1..0d7d13d 100644
--- a/gallery_dl/extractor/booru.py
+++ b/gallery_dl/extractor/booru.py
@@ -25,6 +25,7 @@ class BooruExtractor(BaseExtractor):
data = self.metadata()
tags = self.config("tags", False)
notes = self.config("notes", False)
+ fetch_html = tags or notes
for post in self.posts():
try:
@@ -36,11 +37,13 @@ class BooruExtractor(BaseExtractor):
"(md5: %s)", post.get("id"), post.get("md5"))
continue
- page_html = None
- if tags:
- page_html = self._extended_tags(post)
- if notes:
- self._notes(post, page_html)
+ if fetch_html:
+ html = self._html(post)
+ if tags:
+ self._tags(post, html)
+ if notes:
+ self._notes(post, html)
+
text.nameext_from_url(url, post)
post.update(data)
self._prepare(post)
@@ -67,16 +70,13 @@ class BooruExtractor(BaseExtractor):
_file_url = operator.itemgetter("file_url")
def _prepare(self, post):
- """Prepare the 'post's metadata"""
+ """Prepare a 'post's metadata"""
- def _extended_tags(self, post, page=None):
- """Generate extended tag information
+ def _html(self, post):
+ """Return HTML content of a post"""
- The return value of this function will be
- passed to the _notes function as the page parameter.
- This makes it possible to reuse the same HTML both for
- extracting tags and notes.
- """
+ def _tags(self, post, page):
+ """Extract extended tag metadata"""
- def _notes(self, post, page=None):
- """Generate information about notes"""
+ def _notes(self, post, page):
+ """Extract notes metadata"""