From 9a6863116bfd8d5733cb1b1b426a8551076dff65 Mon Sep 17 00:00:00 2001
From: lyg <1543117173@qq.com>
Date: 星期三, 12 六月 2024 20:09:44 +0800
Subject: [PATCH] 修改日志解析

---
 /dev/null         |    8 --------
 .gitignore        |    6 +++++-
 src/parse-log.mjs |   11 +++++++++++
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index e221ade..fbd5585 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,8 @@
 **/*.xlsx
 downloads
 **/*.log
-logs
\ No newline at end of file
+logs
+failed-book-urls.txt
+failed-books.txt
+no-file-books.txt
+not-found-books.txt
diff --git a/failed-book-urls.txt b/failed-book-urls.txt
deleted file mode 100644
index b08d200..0000000
--- a/failed-book-urls.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-https://archive.org/compress/DnaEm1CapabilitiesOfNuclearWeapons/formats=TEXT%20PDF,IMAGE%20CONTAINER%20PDF&file=/DnaEm1CapabilitiesOfNuclearWeapons.zip
-https://archive.org/download/annualcatalogueo1835wmrp_0/annualcatalogueo1835wmrp_0.pdf
-https://archive.org/download/cu31924017199948/cu31924017199948.pdf
-https://archive.org/download/CAT31285342/CAT31285342.pdf
-https://archive.org/download/17thannualcatalo1902germ/17thannualcatalo1902germ.pdf
-https://archive.org/download/CAT31284692/CAT31284692.pdf
-https://archive.org/download/CAT31322806/CAT31322806.pdf
-https://archive.org/download/charliealexander00robe/charliealexander00robe.pdf
\ No newline at end of file
diff --git a/failed-books.txt b/failed-books.txt
deleted file mode 100644
index 07b3d1d..0000000
--- a/failed-books.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-10800062 https://archive.org/compress/DnaEm1CapabilitiesOfNuclearWeapons/formats=TEXT%20PDF,IMAGE%20CONTAINER%20PDF&file=/DnaEm1CapabilitiesOfNuclearWeapons.zip
-10908504 https://archive.org/download/annualcatalogueo1835wmrp_0/annualcatalogueo1835wmrp_0.pdf
-10519421 https://archive.org/download/cu31924017199948/cu31924017199948.pdf
-10893593 https://archive.org/download/CAT31285342/CAT31285342.pdf
-10830912 https://archive.org/download/17thannualcatalo1902germ/17thannualcatalo1902germ.pdf
-10893203 https://archive.org/download/CAT31284692/CAT31284692.pdf
-11181828 https://archive.org/download/CAT31322806/CAT31322806.pdf
-10538507 https://archive.org/download/charliealexander00robe/charliealexander00robe.pdf
\ No newline at end of file
diff --git a/src/parse-log.mjs b/src/parse-log.mjs
index 3875c1c..0976059 100644
--- a/src/parse-log.mjs
+++ b/src/parse-log.mjs
@@ -53,6 +53,11 @@
           }
           continue;
         }
+        reg = /.*娌℃湁鎼滅储缁撴灉.*/g;
+        if (reg.test(line)) {
+          book.notFound = true;
+          continue;
+        }
       }
 
     }
@@ -71,4 +76,10 @@
   const failedBookUrls = books.filter(book => !book.download && book.downloadUrl)
     .map(book => book.downloadUrl).join('\n');
   fs.writeFileSync('./failed-book-urls.txt', failedBookUrls);
+
+  const notFoundBooks = books.filter(book => book.notFound).map(book => book.bookId).join('\n');
+  fs.writeFileSync('./not-found-books.txt', notFoundBooks);
+
+  const noFileBooks = books.filter(book => !book.download && !book.downloadUrl).map(book => book.bookId).join('\n');
+  fs.writeFileSync('./no-file-books.txt', noFileBooks);
 }
\ No newline at end of file

--
Gitblit v1.9.1