redownload implemented; spellcheck

This commit is contained in:
2022-07-07 08:49:41 +02:00
parent ae44def45b
commit 0346974211
3 changed files with 25 additions and 8 deletions
+9 -4
View File
@@ -1,4 +1,3 @@
//const fs = require('fs');
const fs = require('node:fs/promises');
const path = require('path');
const HTMLparser = require('node-html-parser');
@@ -39,8 +38,8 @@ function padNumber(num, len) {
function log(text) {
let d = new Date();
let datetime = `${d.getFullYear()}.${padNumber((d.getMonth() + 1), 2)}.${padNumber(d.getDate(), 2)}_${padNumber(d.getHours(), 2)}:${padNumber(d.getMinutes(), 2)}:${padNumber(d.getSeconds(), 2)}.${padNumber(d.getMilliseconds(), 3)}`;
fs.appendFile(cleanPath(`./WNtoEmail.log`), `${datetime} ${text}\n`);
let dateTime = `${d.getFullYear()}.${padNumber((d.getMonth() + 1), 2)}.${padNumber(d.getDate(), 2)}_${padNumber(d.getHours(), 2)}:${padNumber(d.getMinutes(), 2)}:${padNumber(d.getSeconds(), 2)}.${padNumber(d.getMilliseconds(), 3)}`;
fs.appendFile(cleanPath(`./WNtoEmail.log`), `${dateTime} ${text}\n`);
}
async function mkDir(dirPath) {
@@ -191,7 +190,7 @@ function sendEbook(subject, ebookAttachments) {
}
}
async function fetch_smth(URL, hosting) {
async function fetch_something(URL, hosting) {
let fetchURL = await fetch(URL);
if (fetchURL.ok) {
@@ -317,6 +316,12 @@ async function main() {
let chapters = [];
let nextChapterURL;
if (novel['redownload']) {
novel['completed'] = false;
novel['lastChapterURL'] = false;
novel['lastVolume'] = 0;
}
if (!novel['completed']) {
let novelInfo = await fetchNovelInfo(novel['novelURL'], 'NF');