修改文件目录结构;小改动
This commit is contained in:
parent
a2af3be807
commit
e588e463d5
11
index.js
11
index.js
@ -38,7 +38,10 @@ const execute_command = require('./src/execute_command');
|
|||||||
*/
|
*/
|
||||||
console.log("Start running ...");
|
console.log("Start running ...");
|
||||||
|
|
||||||
// 程序主函数
|
|
||||||
|
/**
|
||||||
|
* 程序主函数
|
||||||
|
*/
|
||||||
async function start() {
|
async function start() {
|
||||||
// 爬取热搜数据
|
// 爬取热搜数据
|
||||||
await get_hotband.main();
|
await get_hotband.main();
|
||||||
@ -55,10 +58,14 @@ if (EXECUTE_AT_STARTUP) {
|
|||||||
// refer: https://www.npmjs.com/package/node-schedule
|
// refer: https://www.npmjs.com/package/node-schedule
|
||||||
const scheduleJob = schedule.scheduleJob('05 * * * * *', start);
|
const scheduleJob = schedule.scheduleJob('05 * * * * *', start);
|
||||||
|
|
||||||
// 定时推送
|
|
||||||
|
/**
|
||||||
|
* 定时将热搜数据推送到 Git 仓库
|
||||||
|
*/
|
||||||
async function pushToGitRepo() {
|
async function pushToGitRepo() {
|
||||||
let commands = [
|
let commands = [
|
||||||
'git status',
|
'git status',
|
||||||
|
'git pull',
|
||||||
'git add .',
|
'git add .',
|
||||||
`git commit -m "${new Date(Date.now() + 8 * 3600 * 1000).toISOString().substring(0, 19).replace('T', ' ')} update"`,
|
`git commit -m "${new Date(Date.now() + 8 * 3600 * 1000).toISOString().substring(0, 19).replace('T', ' ')} update"`,
|
||||||
`git push origin master`,
|
`git push origin master`,
|
||||||
|
@ -54,9 +54,9 @@ function saveJSON({ now, fileNameSuffix, object, compress = true, uncompress = t
|
|||||||
// console.log( "year, month, day, hour, minute: " + year + ", " + month + ", " + day + ", " + hour + ", " + minute);
|
// console.log( "year, month, day, hour, minute: " + year + ", " + month + ", " + day + ", " + hour + ", " + minute);
|
||||||
|
|
||||||
// 创建当前文件夹
|
// 创建当前文件夹
|
||||||
let folder = `${DATA_FOLDER}/${year}/${month}/${day}`;
|
let folder = `${DATA_FOLDER}/${fileNameSuffix}/${year}/${month}/${day}`;
|
||||||
createFolder(folder);
|
createFolder(folder);
|
||||||
let fileName = `${folder}/${year}${month}${day}_${hour}${minute}_${fileNameSuffix}`;
|
let fileName = `${folder}/${year}${month}${day}_${hour}${minute}`;
|
||||||
|
|
||||||
// 生成文件名
|
// 生成文件名
|
||||||
// '2022-07-23T10:11:38.650Z' => '20220723_1011'
|
// '2022-07-23T10:11:38.650Z' => '20220723_1011'
|
||||||
@ -229,9 +229,9 @@ async function main() {
|
|||||||
now: now,
|
now: now,
|
||||||
fileNameSuffix: `simplify`,
|
fileNameSuffix: `simplify`,
|
||||||
object: data,
|
object: data,
|
||||||
// compress: true,
|
compress: true,
|
||||||
// uncompress: true,
|
// uncompress: true,
|
||||||
compress: false,
|
// compress: false,
|
||||||
uncompress: false,
|
uncompress: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user