New file |
| | |
| | | import * as fs from 'fs'; |
| | | import xlsx from "node-xlsx"; |
| | | |
| | | async function main() { |
| | | const dir = ''; |
| | | const files = fs.readdirSync(dir); |
| | | const books = []; |
| | | const bookMap = {}; |
| | | const workSheets = xlsx.parse("【第二批二次处理后】交付清单.xlsx"); |
| | | const sheet = workSheets[0]; |
| | | const data = sheet.data; |
| | | data[0][12] = '文件名'; |
| | | data[0][13] = '状态'; |
| | | |
| | | for (const file of files) { |
| | | const ext = file.substring(file.lastIndexOf('.') + 1); |
| | | const name = file.substring(0, file.lastIndexOf('.')); |
| | | const [id, title] = name.split(' '); |
| | | bookMap[name] = { id, title, file }; |
| | | } |
| | | for (const book of data.slice(1)) { |
| | | const _id = book[0] + ' ' + book[1]; |
| | | const bookInfo = bookMap[_id]; |
| | | if (bookInfo) { |
| | | book[12] = bookInfo.file; |
| | | book[13] = '以提供'; |
| | | } |
| | | } |
| | | } |
| | |
| | | import path from "path"; |
| | | import { Worker, isMainThread, parentPort, workerData, threadId } from 'worker_threads'; |
| | | import { HttpsProxyAgent } from "https-proxy-agent"; |
| | | import { resolve } from "path"; |
| | | import { execFileSync } from "child_process"; |
| | | import wordsjs from 'wordlist-js'; |
| | | import usPlaceList from "./us-place-list.mjs"; |
| | |
| | | |
| | | const noFileBooks = books.filter(book => !book.download && !book.downloadUrl).map(book => book.bookId).join('\n'); |
| | | fs.writeFileSync('./no-file-books.txt', noFileBooks); |
| | | |
| | | const successBooks = books.filter(book => book.download).map(book => book.bookId).join('\n'); |
| | | fs.writeFileSync('./success-books.txt', successBooks); |
| | | } |