From ce8cb9c851fa66c7c2902ceb57e369d3cecf1a28 Mon Sep 17 00:00:00 2001
From: lyg <1543117173@qq.com>
Date: 星期四, 01 八月 2024 01:48:56 +0800
Subject: [PATCH] 复制bt下载的文件,bt任务控制

---
 src/book-list-download.mjs |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/book-list-download.mjs b/src/book-list-download.mjs
index e6b73c2..727d019 100644
--- a/src/book-list-download.mjs
+++ b/src/book-list-download.mjs
@@ -62,9 +62,9 @@
 }
 
 async function main() {
-  const years = genYears(2023, 2024);
+  const years = genYears(1950, 2024);
   const codeList = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
-  const bookList = [["id", "isbn", "涓绘爣棰�", "鍓爣棰�", "浣滆��", "鍑虹増绀�", "鍑虹増鏃堕棿", "涓浘娉曞垎绫�", "鏍煎紡", "璇█", "绠�浠�", "椤垫暟"]];
+  const bookList = [["Title", "Author", "Year", "Publisher", "ISBN"]];
   try {
     for (const year of years) {
       for (const code of codeList) {
@@ -85,7 +85,7 @@
             const { identifier, title, creator } = hit.fields
             const author = creator?.join(", ");
             console.log(`${identifier} | ${title} | ${author??''}`);
-            bookList.push([identifier, "", title, "", author, "", "", "", "", "English"]);
+            bookList.push([title, author, null, null, null]);
           }
           page++;
           await sleep(getRandomNumber(3000, 80000));
@@ -106,18 +106,10 @@
   }
 }
 
-function failed2Excel() {
-  const ids = fs.readFileSync("C:\\Users\\lyg\\Downloads\\not-found-books.txt", "utf-8").split("\n");
-  const workSheets = xlsx.parse("銆愮浜屾壒浜屾澶勭悊鍚庛�戜氦浠樻竻鍗�.xlsx");
-  const sheet = workSheets[0];
-  const rows = sheet.data.filter((row) => ids.includes(row[0]));
-  const buffer = xlsx.build([{ name: "Sheet1", data: rows }]);
-  fs.writeFileSync("C:\\Users\\lyg\\Downloads\\not-found-books.xlsx", buffer, (err) => { });
-}
-failed2Excel();
-// initLogger();
-// main()
-//   .finally(() => {
-//     logFile.close();
-//   });
+
+initLogger();
+main()
+  .finally(() => {
+    logFile.close();
+  });
 

--
Gitblit v1.9.1