summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/gelbooru.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/gelbooru.py
parente59d46ecda74190381b1d2725b0bd9df5c0be8d8 (diff)
New upstream version 1.24.0.upstream/1.24.0
Diffstat (limited to 'gallery_dl/extractor/gelbooru.py')
-rw-r--r--gallery_dl/extractor/gelbooru.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/gallery_dl/extractor/gelbooru.py b/gallery_dl/extractor/gelbooru.py
index a2cf0c0..d8109e1 100644
--- a/gallery_dl/extractor/gelbooru.py
+++ b/gallery_dl/extractor/gelbooru.py
@@ -68,6 +68,22 @@ class GelbooruBase():
yield "https://img2.gelbooru.com" + path
yield "https://img1.gelbooru.com" + path
+ def _notes(self, post, page):
+ notes_data = text.extr(page, '<section id="notes"', '</section>')
+ if not notes_data:
+ return
+
+ post["notes"] = notes = []
+ extr = text.extract
+ for note in text.extract_iter(notes_data, '<article', '</article>'):
+ notes.append({
+ "width" : int(extr(note, 'data-width="', '"')[0]),
+ "height": int(extr(note, 'data-height="', '"')[0]),
+ "x" : int(extr(note, 'data-x="', '"')[0]),
+ "y" : int(extr(note, 'data-y="', '"')[0]),
+ "body" : extr(note, 'data-body="', '"')[0],
+ })
+
class GelbooruTagExtractor(GelbooruBase,
gelbooru_v02.GelbooruV02TagExtractor):
@@ -182,21 +198,21 @@ class GelbooruPostExtractor(GelbooruBase,
"keywords": {
"notes": [
{
- "height": 553,
"body": "Look over this way when you talk~",
+ "height": 553,
"width": 246,
"x": 35,
- "y": 72
+ "y": 72,
},
{
- "height": 557,
"body": "Hey~\nAre you listening~?",
+ "height": 557,
"width": 246,
"x": 1233,
- "y": 109
- }
- ]
- }
+ "y": 109,
+ },
+ ],
+ },
}),
)