summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/8kun.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2020-11-13 19:17:03 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2020-11-13 19:17:03 -0500
commit209a3c800871cd68edd2bc7ae661a24ecd496d2d (patch)
treecf81c47ab57540b58292295c7d5641e9d2668291 /gallery_dl/extractor/8kun.py
parent5dc7d6f5902ddaee5223d041d5c10060f0c72430 (diff)
New upstream version 1.15.3.upstream/1.15.3
Diffstat (limited to 'gallery_dl/extractor/8kun.py')
-rw-r--r--gallery_dl/extractor/8kun.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/gallery_dl/extractor/8kun.py b/gallery_dl/extractor/8kun.py
index 47fe672..e55bb08 100644
--- a/gallery_dl/extractor/8kun.py
+++ b/gallery_dl/extractor/8kun.py
@@ -20,10 +20,17 @@ class _8kunThreadExtractor(Extractor):
filename_fmt = "{time}{num:?-//} {filename}.{extension}"
archive_fmt = "{board}_{thread}_{tim}"
pattern = r"(?:https?://)?8kun\.top/([^/]+)/res/(\d+)"
- test = ("https://8kun.top/test/res/65248.html", {
- "pattern": r"https://media\.8kun\.top/file_store/\w{64}\.\w+",
- "count": ">= 8",
- })
+ test = (
+ ("https://8kun.top/test/res/65248.html", {
+ "pattern": r"https://media\.8kun\.top/file_store/\w{64}\.\w+",
+ "count": ">= 8",
+ }),
+ # old-style file URLs (#1101)
+ ("https://8kun.top/d/res/13258.html", {
+ "pattern": r"https://media\.8kun\.top/d/src/\d+(-\d)?\.\w+",
+ "range": "1-20",
+ }),
+ )
def __init__(self, match):
Extractor.__init__(self, match)
@@ -56,7 +63,10 @@ class _8kunThreadExtractor(Extractor):
def _process(post, data):
post.update(data)
post["extension"] = post["ext"][1:]
- url = "https://media.8kun.top/file_store/" + post["tim"] + post["ext"]
+ tim = post["tim"]
+ url = ("https://media.8kun.top/" +
+ ("file_store/" if len(tim) > 16 else post["board"] + "/src/") +
+ tim + post["ext"])
return Message.Url, url, post