[wikimedia] fix name of files without extension
This commit is contained in:
@@ -74,9 +74,7 @@ class WikimediaExtractor(BaseExtractor):
|
||||
m["name"]: m["value"]
|
||||
for m in image["commonmetadata"] or ()}
|
||||
|
||||
filename = image["canonicaltitle"]
|
||||
image["filename"], _, image["extension"] = \
|
||||
filename.partition(":")[2].rpartition(".")
|
||||
text.nameext_from_url(image["canonicaltitle"].partition(":")[2], image)
|
||||
image["date"] = text.parse_datetime(
|
||||
image["timestamp"], "%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
|
||||
@@ -104,6 +104,19 @@ __tests__ = (
|
||||
"#class" : wikimedia.WikimediaArticleExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://youtube.fandom.com/wiki/File:(500)_Montage_-_Reason_2_Die_Awakening",
|
||||
"#comment" : "file without extension",
|
||||
"#category": ("wikimedia", "fandom-youtube", "file"),
|
||||
"#class" : wikimedia.WikimediaArticleExtractor,
|
||||
|
||||
"extension": "",
|
||||
"filename" : "(500) Montage - Reason 2 Die Awakening",
|
||||
"page" : "File:(500)_Montage_-_Reason_2_Die_Awakening",
|
||||
"sha1" : "6819869792d85927d60cc0a0cdc9e33dbd446731",
|
||||
"size" : 81905,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://youtube.fandom.com",
|
||||
"#category": ("wikimedia", "fandom-youtube", "wiki"),
|
||||
|
||||
Reference in New Issue
Block a user