@kadaliao/geektime-downloader 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/download.js +7 -3
- package/package.json +1 -1
package/download.js
CHANGED
|
@@ -237,7 +237,7 @@ function parseCookies(cookieString) {
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
//
|
|
240
|
+
// 获取专栏所有文章列表(通过API)
|
|
241
241
|
async function getArticleList(page, columnUrl) {
|
|
242
242
|
const spinner = ora('正在获取专栏信息...').start();
|
|
243
243
|
|
|
@@ -462,7 +462,8 @@ async function getArticleList(page, columnUrl) {
|
|
|
462
462
|
|
|
463
463
|
// 解析文章列表
|
|
464
464
|
const rawArticles = articlesData.data.list;
|
|
465
|
-
|
|
465
|
+
|
|
466
|
+
const articles = rawArticles.map((article, index) => {
|
|
466
467
|
const title = article.article_title || article.article_sharetitle || 'Untitled';
|
|
467
468
|
const id = article.id;
|
|
468
469
|
|
|
@@ -477,7 +478,10 @@ async function getArticleList(page, columnUrl) {
|
|
|
477
478
|
title: cleanTitle,
|
|
478
479
|
url: `https://time.geekbang.org/column/article/${id}`,
|
|
479
480
|
originalTitle: title,
|
|
480
|
-
id: id
|
|
481
|
+
id: id,
|
|
482
|
+
sectionName: article.section_name || '',
|
|
483
|
+
chapterIndex: article.chapter_index || 0,
|
|
484
|
+
originalIndex: index
|
|
481
485
|
};
|
|
482
486
|
});
|
|
483
487
|
|