更新首页
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
require('dotenv').config()
|
||||
async function main() {
|
||||
console.log('[News] 开始拉取...')
|
||||
const t0 = Date.now()
|
||||
const mod = await import('./fetchers/news.fetcher.js')
|
||||
const list = await mod.fetchNewsList()
|
||||
console.log('[News] 拉取 ' + list.length + ' 条, 耗时 ' + ((Date.now() - t0) / 1000).toFixed(1) + 's')
|
||||
if (list.length === 0) { console.log('[News] 无数据, 跳过'); return }
|
||||
const r = await mod.persistNews(list)
|
||||
console.log('[News] 入库: 新增 ' + r.inserted + ' 条, 重复跳过 ' + r.skipped + ' 条')
|
||||
}
|
||||
main().catch((e) => { console.error('[News] 失败:', e); process.exit(1) })
|
||||
Reference in New Issue
Block a user