From 2dfe97dd00bf13f1cbf85a6d312f57aff4be215b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 21 Nov 2015 03:13:06 +0100 Subject: [PATCH] [chan] update to new format --- gallery_dl/extractor/4chan.py | 15 +++------------ gallery_dl/extractor/8chan.py | 15 +++------------ gallery_dl/extractor/chan.py | 6 ++++-- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/gallery_dl/extractor/4chan.py b/gallery_dl/extractor/4chan.py index 9aab90a2..b28c25dc 100644 --- a/gallery_dl/extractor/4chan.py +++ b/gallery_dl/extractor/4chan.py @@ -10,23 +10,14 @@ from .chan import ChanExtractor -info = { - "category": "4chan", - "extractor": "FourChanExtractor", - "directory": ["{category}", "{board}-{thread}"], - "filename": "{tim}-{filename}{ext}", - "pattern": [ - r"(?:https?://)?boards\.4chan\.org/([^/]+)/thread/(\d+).*", - ], -} - class FourChanExtractor(ChanExtractor): + category = "4chan" + pattern = [r"(?:https?://)?boards\.4chan\.org/([^/]+)/thread/(\d+)"] api_url = "https://a.4cdn.org/{board}/thread/{thread}.json" file_url = "https://i.4cdn.org/{board}/{tim}{ext}" def __init__(self, match): ChanExtractor.__init__( - self, info["category"], - match.group(1), match.group(2) + self, match.group(1), match.group(2) ) diff --git a/gallery_dl/extractor/8chan.py b/gallery_dl/extractor/8chan.py index c21b4595..5dcd200f 100644 --- a/gallery_dl/extractor/8chan.py +++ b/gallery_dl/extractor/8chan.py @@ -10,23 +10,14 @@ from .chan import ChanExtractor -info = { - "category": "8chan", - "extractor": "InfinityChanExtractor", - "directory": ["{category}", "{board}-{thread}"], - "filename": "{tim}-{filename}{ext}", - "pattern": [ - r"(?:https?://)?(?:www\.)?8ch\.net/([^/]+)/res/(\d+).*", - ], -} - class InfinityChanExtractor(ChanExtractor): + category = "8chan" + pattern = [r"(?:https?://)?(?:www\.)?8ch\.net/([^/]+)/res/(\d+)"] api_url = "https://8ch.net/{board}/res/{thread}.json" file_url = "https://8ch.net/{board}/src/{tim}{ext}" def __init__(self, match): ChanExtractor.__init__( - self, info["category"], - match.group(1), match.group(2) + self, match.group(1), match.group(2) ) diff --git a/gallery_dl/extractor/chan.py b/gallery_dl/extractor/chan.py index 68217d58..1dab5fd4 100644 --- a/gallery_dl/extractor/chan.py +++ b/gallery_dl/extractor/chan.py @@ -13,13 +13,15 @@ from .. import text class ChanExtractor(Extractor): + directory_fmt = ["{category}", "{board}-{thread}"] + filename_fmt = "{tim}-{filename}{ext}" api_url = "" file_url = "" - def __init__(self, category, board, thread): + def __init__(self, board, thread): Extractor.__init__(self) self.metadata = { - "category": category, + "category": self.category, "board": board, "thread": thread, }