[2chen] add '.club' support (#3406)

pull/3414/head
enduser420 2 years ago committed by GitHub
parent a6d4733e11
commit a2be06d873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,18 +17,21 @@ class _2chenThreadExtractor(Extractor):
directory_fmt = ("{category}", "{board}", "{thread} {title}") directory_fmt = ("{category}", "{board}", "{thread} {title}")
filename_fmt = "{time} {filename}.{extension}" filename_fmt = "{time} {filename}.{extension}"
archive_fmt = "{board}_{thread}_{hash}_{time}" archive_fmt = "{board}_{thread}_{hash}_{time}"
root = "https://2chen.moe" pattern = r"(?:https?://)?2chen\.(?:moe|club)/([^/?#]+)/(\d+)"
pattern = r"(?:https?://)?2chen\.moe/([^/?#]+)/(\d+)"
test = ( test = (
("https://2chen.moe/tv/496715", { ("https://2chen.moe/tv/496715", {
"count": ">= 179", "count": ">= 179",
}), }),
("https://2chen.club/tv/1", {
"count": 5,
}),
# 404 # 404
("https://2chen.moe/jp/303786"), ("https://2chen.moe/jp/303786"),
) )
def __init__(self, match): def __init__(self, match):
Extractor.__init__(self, match) Extractor.__init__(self, match)
self.root = text.root_from_url(match.group(0))
self.board, self.thread = match.groups() self.board, self.thread = match.groups()
def items(self): def items(self):
@ -78,18 +81,19 @@ class _2chenBoardExtractor(Extractor):
"""Extractor for 2chen boards""" """Extractor for 2chen boards"""
category = "2chen" category = "2chen"
subcategory = "board" subcategory = "board"
root = "https://2chen.moe" pattern = r"(?:https?://)?2chen\.(?:moe|club)/([^/?#]+)(?:/catalog|/?$)"
pattern = r"(?:https?://)?2chen\.moe/([^/?#]+)(?:/catalog|/?$)"
test = ( test = (
("https://2chen.moe/co/", { ("https://2chen.moe/co/", {
"pattern": _2chenThreadExtractor.pattern "pattern": _2chenThreadExtractor.pattern
}), }),
("https://2chen.moe/co"), ("https://2chen.moe/co"),
("https://2chen.moe/co/catalog") ("https://2chen.club/tv"),
("https://2chen.moe/co/catalog"),
) )
def __init__(self, match): def __init__(self, match):
Extractor.__init__(self, match) Extractor.__init__(self, match)
self.root = text.root_from_url(match.group(0))
self.board = match.group(1) self.board = match.group(1)
def items(self): def items(self):

Loading…
Cancel
Save