|
import fetch from 'node-fetch'; |
|
import { exec } from 'child_process'; |
|
|
|
|
|
const url0 = 'https://zzmal-m.hf.space'; |
|
const url1 = 'https://zzmal-al.hf.space'; |
|
|
|
|
|
async function fetchData() { |
|
try { |
|
|
|
let response = await fetch(url0); |
|
|
|
if (response.ok) { |
|
console.log('请求成功: ', url0); |
|
} else { |
|
console.error('请求失败: ', response.statusText); |
|
} |
|
|
|
response = await fetch(url1); |
|
|
|
if (response.ok) { |
|
console.log('请求成功: ', url1); |
|
} else { |
|
console.error('请求失败: ', response.statusText); |
|
} |
|
} catch (error) { |
|
console.error('出现错误:', error.message); |
|
} |
|
} |
|
|
|
|
|
function performPing() { |
|
|
|
exec('ping -c 1 zzmal-m.hf.space', (err, stdout, stderr) => { |
|
if (err) { |
|
console.error('ping失败: ', err); |
|
return; |
|
} |
|
console.log('ping结果: ', stdout); |
|
}); |
|
|
|
exec('ping -c 1 zzmal-mm.hf.space', (err, stdout, stderr) => { |
|
if (err) { |
|
console.error('ping失败: ', err); |
|
return; |
|
} |
|
console.log('ping结果: ', stdout); |
|
}); |
|
} |
|
|
|
|
|
setInterval(() => { |
|
fetchData(); |
|
}, 5 * 24 * 60 * 60 * 888); |
|
|
|
|
|
fetchData(); |
|
|