INNER CODE UNIT · TypeScript
gotoUrl
mifi/instauto · src/index.ts:380
const gotoUrl = async (url: string) => page.goto(url, { waitUntil: ['load', 'domcontentloaded', 'networkidle0'] });
async function gotoWithRetry(url: string) {
const maxAttempts = 3;
for (let attempt = 0; ; attempt += 1) {
logger.log(`Goto ${url}`);
const response = await gotoUrl(url);
if (!response) throw new Error('Navigation did not return a response');
const status = response.status();
logger.log('Page loaded');
await sleep(2000);
// https://www.reddit.com/r/Instagram/comments/kwrt0s/error_560/
// https://github.com/mifi/instauto/issues/60
if (![560, 429].includes(status)) return status;
if (attempt > maxAttempts) {
throw new Error(`Navigate to user failed after ${maxAttempts} attempts, last status: ${status}`);