diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 7a78da8..545b1ac 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -26,7 +26,7 @@ jobs:
# cache key.
- uses: actions/cache@v4
with:
- key: worm-scraper-cache-2025-01-02
+ key: worm-scraper-cache-2025-01-04
path: ./cache
- run: node ./lib/worm-scraper.js --book=worm
diff --git a/lib/convert.js b/lib/convert.js
index b22fbd8..75efc14 100644
--- a/lib/convert.js
+++ b/lib/convert.js
@@ -59,6 +59,7 @@ function getChapterData(arcs, manifest, chapterTitleStyle) {
chapter.originalTitle = manifestEntry.title;
chapter.usedTitle = chooseChapterTitle(chapter, chapterTitleStyle);
chapter.datePublished = manifestEntry.datePublished;
+ chapter.dateModified = manifestEntry.dateModified;
}
}
diff --git a/lib/download.js b/lib/download.js
index fea5291..a3b9adf 100644
--- a/lib/download.js
+++ b/lib/download.js
@@ -70,11 +70,13 @@ async function downloadAllChapters(manifest, bookData, cachePath, manifestPath)
const { contents, dom } = await downloadChapter(chapterURL);
const title = getChapterTitle(dom.window.document);
const datePublished = getChapterDatePublished(dom.window.document);
+ const dateModified = getChapterDateModified(dom.window.document);
dom.window.close();
manifest[manifestIndex].title = title;
manifest[manifestIndex].datePublished = datePublished;
+ manifest[manifestIndex].dateModified = dateModified;
manifest[manifestIndex].filename = filename;
await fs.writeFile(path.resolve(cachePath, filename), contents);
@@ -105,7 +107,11 @@ function getChapterTitle(rawChapterDoc) {
}
function getChapterDatePublished(rawChapterDoc) {
- return rawChapterDoc.querySelector(".entry-date").dateTime;
+ return rawChapterDoc.querySelector(`meta[property="article:published_time"]`).content;
+}
+
+function getChapterDateModified(rawChapterDoc) {
+ return rawChapterDoc.querySelector(`meta[property="article:modified_time"]`).content;
}
async function downloadChapter(url) {
diff --git a/lib/scaffold.js b/lib/scaffold.js
index 60838f5..87ed173 100644
--- a/lib/scaffold.js
+++ b/lib/scaffold.js
@@ -1,9 +1,12 @@
"use strict";
const fs = require("fs").promises;
const path = require("path");
+const { name: packageName, version: packageVersion } = require("../package.json");
+const BOOK_SERIES = "Parahumans";
const BOOK_PUBLISHER = "Domenic Denicola";
const BOOK_AUTHOR = "Wildbow";
+const BOOK_GENERATOR = `${packageName} v${packageVersion}`;
const STYLES_FILENAME = "chapter.css";
const COVER_DOCUMENT_FILENAME = "cover.xhtml";
@@ -17,15 +20,15 @@ module.exports = async (
bookPath,
contentPath,
chaptersPath,
- augmentedChapterDataPath,
+ chapterDataPath,
bookInfo
) => {
await Promise.all([
fs.cp(scaffoldingPath, bookPath, { recursive: true, filter: noThumbs }),
fs.cp(coverImagePath, path.resolve(bookPath, "OEBPS", COVER_IMAGE_FILENAME)),
- getChapterInfo(contentPath, chaptersPath, augmentedChapterDataPath).then(info => {
+ getChapterInfo(contentPath, chaptersPath, chapterDataPath).then(info => {
return Promise.all([
- writeOPF(contentPath, bookInfo, info.manifestAndSpineFiles, info.datePublished),
+ writeOPF(contentPath, bookInfo, info.manifestAndSpineFiles, info.datePublished, info.dateModified),
writeNav(contentPath, info.manifestAndSpineFiles, info.tocHTML),
writeArcTitlePages(chaptersPath, info.arcTitlePages)
]);
@@ -39,7 +42,7 @@ function noThumbs(filePath) {
return path.basename(filePath) !== "Thumbs.db";
}
-function writeOPF(contentPath, bookInfo, manifestAndSpineFiles, datePublished) {
+function writeOPF(contentPath, bookInfo, manifestAndSpineFiles, datePublished, dateModified) {
const manifestItems = manifestAndSpineFiles.map(f => {
return `