Lint with flake8
This commit is contained in:
@@ -69,15 +69,30 @@ class FoolfuukaExtractor(BaseExtractor):
|
|||||||
# trim filename/timestamp to 13 characters (#7652)
|
# trim filename/timestamp to 13 characters (#7652)
|
||||||
path, _, filename = url.rpartition("/")
|
path, _, filename = url.rpartition("/")
|
||||||
# if it's one of these boards, it should redirect to warosu
|
# if it's one of these boards, it should redirect to warosu
|
||||||
warosu_boards = {"3", "biz", "ck", "diy", "fa", "jp", "lit", "ic", "sci"}
|
warosu_boards = {
|
||||||
|
"3", "biz", "ck", "diy", "fa", "jp", "lit", "ic", "sci"
|
||||||
|
}
|
||||||
# if it's one of these boards, it should redirect to fourplebs
|
# if it's one of these boards, it should redirect to fourplebs
|
||||||
fourplebs_boards = {"tg"}
|
fourplebs_boards = {"tg"}
|
||||||
# if it's one of these archives it's redirecting to it should slice the name
|
# if it's one of these archives, it should slice the name
|
||||||
filename_slice_archives = {"b4k", "desuarchive", "palanq"}
|
filename_slice_archives = {
|
||||||
if (board := next((b for b in warosu_boards if f"/{b}/" in url), None)):
|
"b4k", "desuarchive", "palanq"
|
||||||
|
}
|
||||||
|
board = next(
|
||||||
|
(b for b in warosu_boards if f"/{b}/" in url),
|
||||||
|
None
|
||||||
|
)
|
||||||
|
if board:
|
||||||
url = f"https://warosu.org/{board}/full_image/{filename}"
|
url = f"https://warosu.org/{board}/full_image/{filename}"
|
||||||
elif (board := next((b for b in fourplebs_boards if f"/{b}/" in url), None)):
|
|
||||||
url = f"https://archive.4plebs.org/{board}/full_image/{filename}"
|
board = next(
|
||||||
|
(b for b in fourplebs_boards if f"/{b}/" in url),
|
||||||
|
None
|
||||||
|
)
|
||||||
|
if board:
|
||||||
|
url = (
|
||||||
|
f"https://archive.4plebs.org/{board}/full_image/{filename}"
|
||||||
|
)
|
||||||
elif any(archive in path for archive in filename_slice_archives):
|
elif any(archive in path for archive in filename_slice_archives):
|
||||||
name, _, ext = filename.rpartition(".")
|
name, _, ext = filename.rpartition(".")
|
||||||
if len(name) > 13:
|
if len(name) > 13:
|
||||||
|
|||||||
Reference in New Issue
Block a user