Spaces:
Running
Running
Commit
•
dd20700
1
Parent(s):
659239e
Update index.js
Browse files
index.js
CHANGED
@@ -27,7 +27,7 @@ const urls = [
|
|
27 |
// 访问网页并将结果写入日志
|
28 |
async function scrapeAndLog(url) {
|
29 |
try {
|
30 |
-
const response = await axios.get(url, {timeout:
|
31 |
const timestamp = new Date().toISOString();
|
32 |
const logMessage = `${timestamp}: Web visited Successfully ${url}\n`;
|
33 |
|
@@ -47,7 +47,7 @@ async function scrapeAndLog(url) {
|
|
47 |
}
|
48 |
|
49 |
// 使用cron来安排定期任务
|
50 |
-
cron.schedule('*/
|
51 |
console.log('Running webpage access...');
|
52 |
// 循环访问每个URL
|
53 |
urls.forEach((url) => {
|
|
|
27 |
// 访问网页并将结果写入日志
|
28 |
async function scrapeAndLog(url) {
|
29 |
try {
|
30 |
+
const response = await axios.get(url, {timeout: 3000});
|
31 |
const timestamp = new Date().toISOString();
|
32 |
const logMessage = `${timestamp}: Web visited Successfully ${url}\n`;
|
33 |
|
|
|
47 |
}
|
48 |
|
49 |
// 使用cron来安排定期任务
|
50 |
+
cron.schedule('*/1 * * * *', () => {
|
51 |
console.log('Running webpage access...');
|
52 |
// 循环访问每个URL
|
53 |
urls.forEach((url) => {
|