Skip to content

Commit 1fbce5b

Browse files
author
liuyi
committed
feat: filter useless data
1 parent 39c2587 commit 1fbce5b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

server/juejin/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const getJueJinArticleList = async () => {
1313
}
1414
const res = await axios.post('https://api.juejin.cn/content_api/v1/article/query_list', params)
1515
const { data, has_more } = res.data
16-
result = result.concat(data)
16+
data !== null && (result = result.concat(data))
1717
has_more && await loop(res.data.cursor)
1818
}
1919
console.log('掘金查询开始')

server/utils/mongodb.js

+4
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ const updateArticleList = async () => {
105105
// 查询文章列表
106106
const getArticleList = async (page, pageSize, sort_type, tag_id) => {
107107
let allArticleList = await Article.find({ isDelete: 0 })
108+
109+
// 过滤部分脏数据
110+
allArticleList = allArticleList.filter(item => !item.url.includes('undefined'))
111+
108112
const totalCount = allArticleList.length
109113

110114
// 带标签查询

0 commit comments

Comments
 (0)