From 1aadc29c5b8a694586528d3499a9bccbfeb00df6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mike=20F=C3=A4hrmann?=
Date: Tue, 23 Jul 2024 09:34:44 +0200
Subject: [PATCH] [zerochan] fix 'source' extraction
---
gallery_dl/extractor/zerochan.py | 4 ++--
test/results/zerochan.py | 41 ++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/gallery_dl/extractor/zerochan.py b/gallery_dl/extractor/zerochan.py
index 736778f9..6a053737 100644
--- a/gallery_dl/extractor/zerochan.py
+++ b/gallery_dl/extractor/zerochan.py
@@ -76,8 +76,8 @@ class ZerochanExtractor(BooruExtractor):
'class="breadcrumbs', ''))[2:],
"uploader": extr('href="/user/', '"'),
"tags" : extr('
').rpartition(
- ">")[2] or None,
+ "source" : text.unescape(text.extr(
+ extr('id="source-url"', ''), 'href="', '"')),
}
html = data["tags"]
diff --git a/test/results/zerochan.py b/test/results/zerochan.py
index e56812fe..ce5efe45 100644
--- a/test/results/zerochan.py
+++ b/test/results/zerochan.py
@@ -63,6 +63,7 @@ __tests__ = (
"Perth (Kantai Collection)",
],
"size" : 1975296,
+ "source" : "",
"tags" : [
"Mangaka:YeFan 葉凡",
"Game:Kantai Collection",
@@ -102,6 +103,7 @@ __tests__ = (
"Perth (Kantai Collection)",
],
"size" : 1975296,
+ "source" : "",
"tags" : [
"Mangaka:YeFan 葉凡",
"Game:Kantai Collection",
@@ -113,4 +115,43 @@ __tests__ = (
"width" : 1920,
},
+{
+ "#url" : "https://www.zerochan.net/4233756",
+ "#category": ("booru", "zerochan", "image"),
+ "#class" : zerochan.ZerochanImageExtractor,
+ "#urls" : "https://static.zerochan.net/DRAGON.BALL.full.4233756.jpg",
+
+ "author" : "Raydash",
+ "date" : "dt:2024-07-23 00:10:51",
+ "extension": "jpg",
+ "file_url" : "https://static.zerochan.net/DRAGON.BALL.full.4233756.jpg",
+ "filename" : "DRAGON.BALL.full.4233756",
+ "height" : 1125,
+ "id" : 4233756,
+ "path" : [
+ "Toriyama Akira",
+ "DRAGON BALL",
+ ],
+ "size" : 136192,
+ "source": "https://x.com/Raydash30/status/1766012730769862774",
+ "tags" : [
+ "Mangaka:Raydash",
+ "Series:DRAGON BALL",
+ "Series:DRAGON BALL Z",
+ "Character:Piccolo",
+ "Character:Son Gohan",
+ "Theme:Duo",
+ "Theme:Green Skin",
+ "Theme:Male",
+ "Theme:Male Focus",
+ "Theme:Two Males",
+ "Source:Fanart",
+ "Source:Fanart from X (Twitter)",
+ "Source:X (Twitter)",
+ ],
+ "uploader" : "menotbug",
+ "width" : 750,
+
+},
+
)