Spaces:
Paused
Paused
Update index.js
Browse files17 unmodified lines18192021222324252627282930313233343536373839404142434445464748495051525354555617 unmodified linesconst readFileAsync = promisify(fs.readFile);import fetch from 'node-fetch';
const puppeteer = require('puppeteer');
// Function to ping a websiteasync function pingWebsite() { const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] }); const page = await browser.newPage(); await page.setUserAgent("Mozilla/5.0 (Linux; Android 10; SM-G965U Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/114.0.5735.141 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/420.0.0.32.61;]");
await page.goto('https://huggingface.co/spaces/ArashiCode/api'); // Replace 'https://example.com' with the website you want to ping await page.waitFor(30000); // Wait for 30 seconds console.log("ping") await browser.close();}
// Ping website every 5 hoursasync function pingEvery5Hours() { await pingWebsite(); setInterval(async () => { await pingWebsite(); }, 5 * 60 * 60 * 1000); // 5 hours in milliseconds}
// Start pingingpingEvery5Hours();
const tempDir = path.join(os.tmpdir(), "temp");const fss = fs.promises;
index.js+33