[chan] update to new format

pull/13/head
Mike Fährmann 9 years ago
parent 2d498b19a1
commit 2dfe97dd00
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -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)
)

@ -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)
)

@ -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,
}

Loading…
Cancel
Save