1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[chan] update to new format

This commit is contained in:
Mike Fährmann 2015-11-21 03:13:06 +01:00
parent 2d498b19a1
commit 2dfe97dd00
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 10 additions and 26 deletions

View File

@ -10,23 +10,14 @@
from .chan import ChanExtractor 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): class FourChanExtractor(ChanExtractor):
category = "4chan"
pattern = [r"(?:https?://)?boards\.4chan\.org/([^/]+)/thread/(\d+)"]
api_url = "https://a.4cdn.org/{board}/thread/{thread}.json" api_url = "https://a.4cdn.org/{board}/thread/{thread}.json"
file_url = "https://i.4cdn.org/{board}/{tim}{ext}" file_url = "https://i.4cdn.org/{board}/{tim}{ext}"
def __init__(self, match): def __init__(self, match):
ChanExtractor.__init__( ChanExtractor.__init__(
self, info["category"], self, match.group(1), match.group(2)
match.group(1), match.group(2)
) )

View File

@ -10,23 +10,14 @@
from .chan import ChanExtractor 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): class InfinityChanExtractor(ChanExtractor):
category = "8chan"
pattern = [r"(?:https?://)?(?:www\.)?8ch\.net/([^/]+)/res/(\d+)"]
api_url = "https://8ch.net/{board}/res/{thread}.json" api_url = "https://8ch.net/{board}/res/{thread}.json"
file_url = "https://8ch.net/{board}/src/{tim}{ext}" file_url = "https://8ch.net/{board}/src/{tim}{ext}"
def __init__(self, match): def __init__(self, match):
ChanExtractor.__init__( ChanExtractor.__init__(
self, info["category"], self, match.group(1), match.group(2)
match.group(1), match.group(2)
) )

View File

@ -13,13 +13,15 @@ from .. import text
class ChanExtractor(Extractor): class ChanExtractor(Extractor):
directory_fmt = ["{category}", "{board}-{thread}"]
filename_fmt = "{tim}-{filename}{ext}"
api_url = "" api_url = ""
file_url = "" file_url = ""
def __init__(self, category, board, thread): def __init__(self, board, thread):
Extractor.__init__(self) Extractor.__init__(self)
self.metadata = { self.metadata = {
"category": category, "category": self.category,
"board": board, "board": board,
"thread": thread, "thread": thread,
} }