[kemonoparty] add 'type' metadata field (#1556)
'file', 'attachment', or 'inline'
This commit is contained in:
@@ -35,12 +35,17 @@ class KemonopartyExtractor(Extractor):
|
|||||||
for post in self.posts():
|
for post in self.posts():
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
if post["file"]:
|
append = files.append
|
||||||
files.append(post["file"])
|
file = post["file"]
|
||||||
if post["attachments"]:
|
|
||||||
files.extend(post["attachments"])
|
if file:
|
||||||
|
file["type"] = "file"
|
||||||
|
append(file)
|
||||||
|
for attachment in post["attachments"]:
|
||||||
|
attachment["type"] = "attachment"
|
||||||
|
append(attachment)
|
||||||
for path in find_inline(post["content"] or ""):
|
for path in find_inline(post["content"] or ""):
|
||||||
files.append({"path": path, "name": path})
|
append({"path": path, "name": path, "type": "inline"})
|
||||||
|
|
||||||
post["date"] = text.parse_datetime(
|
post["date"] = text.parse_datetime(
|
||||||
post["published"], "%a, %d %b %Y %H:%M:%S %Z")
|
post["published"], "%a, %d %b %Y %H:%M:%S %Z")
|
||||||
|
|||||||
Reference in New Issue
Block a user