| | |
| | | } |
| | | |
| | | 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) { |
| | |
| | | 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)); |
| | |
| | | } |
| | | } |
| | | |
| | | 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(); |
| | | }); |
| | | |