Skip to content

Commit

Permalink
[ao3] extract 'date_completed' and 'date_updated' metadata (#6013)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Sep 17, 2024
1 parent 064bc89 commit 1d7df9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gallery_dl/extractor/ao3.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def items(self):
extr = text.extract_from(self.request(url).text)

fmts = {}
path = ""
download = extr(' class="download"', "</ul>")
for dl in text.extract_iter(download, ' href="', "</"):
path, _, type = dl.rpartition('">')
Expand All @@ -95,6 +96,10 @@ def items(self):
"series" : extr('<dd class="series">', "</dd>"),
"date" : text.parse_datetime(
extr('<dd class="published">', "<"), "%Y-%m-%d"),
"date_completed": text.parse_datetime(
extr('>Completed:</dt><dd class="status">', "<"), "%Y-%m-%d"),
"date_updated" : text.parse_timestamp(
path.rpartition("updated_at=")[2]),
"words" : text.parse_int(
extr('<dd class="words">', "<").replace(",", "")),
"chapters" : text.parse_int(
Expand Down
2 changes: 2 additions & 0 deletions test/results/ao3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"chapters" : 27,
"comments" : range(800, 2000),
"date" : "dt:2023-06-11 00:00:00",
"date_completed": "dt:2024-05-10 00:00:00",
"date_updated" : "dt:2024-07-08 00:27:04",
"extension": "pdf",
"filename" : "The_Wildcard",
"id" : 47802076,
Expand Down

0 comments on commit 1d7df9c

Please sign in to comment.