change keyword names to valid Python identifiers
This commit mostly replaces all minus-signs ('-') in keyword names with
underscores ('_') to allow them to be used in filter-expressions. For
example 'gallery-id' got renamed to 'gallery_id'.
(It is theoretically possible to access any variable, regardless of its
name, with 'locals()["NAME"]', but that seems a bit too convoluted if
just 'NAME' could be enough)
This commit is contained in:
@@ -16,12 +16,12 @@ class FutabaThreadExtractor(Extractor):
|
||||
"""Extractor for images from threads on www.2chan.net"""
|
||||
category = "2chan"
|
||||
subcategory = "thread"
|
||||
directory_fmt = ["{category}", "{board-name}", "{thread}"]
|
||||
directory_fmt = ["{category}", "{board_name}", "{thread}"]
|
||||
pattern = [r"(?:https?://)?(([^.]+)\.2chan\.net/([^/]+)/res/(\d+))"]
|
||||
urlfmt = "https://{server}.2chan.net/{board}/src/{filename}"
|
||||
test = [("http://dec.2chan.net/70/res/947.htm", {
|
||||
"url": "c5c12b80b290e224b6758507b3bb952044f4595b",
|
||||
"keyword": "e1295c0a96f733898e92742bcc1a4c4b320e3748",
|
||||
"keyword": "4bd22e7a9c3636faecd6ea7082509e8655e10dd0",
|
||||
})]
|
||||
|
||||
def __init__(self, match):
|
||||
@@ -49,7 +49,7 @@ class FutabaThreadExtractor(Extractor):
|
||||
"server": self.server,
|
||||
"title": title,
|
||||
"board": self.board,
|
||||
"board-name": boardname[:-4],
|
||||
"board_name": boardname[:-4],
|
||||
"thread": self.thread,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user