M get-articles.sh => get-articles.sh +1 -1
@@ 1,6 1,5 @@
#!/bin/sh
-date=`date -u "+%Y-%m-%d"`
mkdir -p articles
touch all-article-urls seen-article-urls
@@ 27,6 26,7 @@ do
# Get title from first line of readable.html
# and change any '/' to ' of ' for use as a filename
title=`head -1 readable.html | sed -e 's/\// of /g; s/:/ - /g'`
+ date=`sed -n 2p readable.html`
mv readable.html "articles/$date - $title.html"
printf "Got $title\n"
done < new-article-urls
M make-readable.js => make-readable.js +9 -1
@@ 4,7 4,15 @@ const { JSDOM } = jsdom;
const args = process.argv.slice(2);
const dom = JSDOM.fromFile(args[0]).then(dom => {
- var article = new Readability(dom.window.document).parse();
+ var doc, datetime, date, article;
+ doc = dom.window.document;
+ try {
+ datetime = doc.getElementsByTagName("time")[0].dateTime;
+ } catch (error) {
+ datetime = new Date().toISOString();
+ }
+ article = new Readability(doc).parse();
console.log(article.title);
+ console.log(datetime.substring(0,10));
console.log(article.content);
});