diff --git a/main.js b/main.js index 0da8239..1a94821 100644 --- a/main.js +++ b/main.js @@ -9,7 +9,7 @@ async function getApiResult(url) { method: 'GET', url: url, }, (error, response, result) => { - console.log("error, response, result", error, response, result); + // console.log("error, response, result", error, response, result); if (!error && (response.statusCode == 200)) { // 请求成功 resolve(result); @@ -29,29 +29,31 @@ async function getApiResult(url) { // 目录:https://www.nowcoder.com/content/tutorial/catalog/94 // 文章:https://www.nowcoder.com/content/tutorial/detail/94/ea1986fcff294f6292385703e94689e8 async function main() { + console.log(`获取目录 ${pdfFilePath}`); /** * 爬取数据 */ let urlContent = "https://www.nowcoder.com/content/tutorial/catalog/94"; let result = await getApiResult(urlContent); let data = JSON.parse(result); - console.log(data); + // console.log(data); let catalog = data.data.catalog; - console.log("catalog", catalog); + // console.log("catalog", catalog); for (let chapter = 0; chapter < catalog.length; chapter++) { const sectionList = catalog[chapter]; for (let section = 0; section < sectionList.length; section++) { const sectionInfo = sectionList[section]; // console.log(`${sectionInfo.uuid} ${sectionInfo.title}`); let res = await getDetail(sectionInfo.uuid); - console.log(res); + // console.log(res); } } console.log("完成"); } async function getDetail(uuid) { + console.log(`开始转换 ${pdfFilePath}`); let urlDetail = `https://www.nowcoder.com/content/tutorial/detail/94/${uuid}`; let result = await getApiResult(urlDetail); let data = JSON.parse(result);