INNER CODE UNIT · TypeScript
haveRecentlyFollowedUser
mifi/instauto · src/index.ts:373
function haveRecentlyFollowedUser(username: string) {
const followedUserEntry = getPrevFollowedUser(username);
if (!followedUserEntry) return false; // We did not previously follow this user, so don't know
return Date.now() - followedUserEntry.time < dontUnfollowUntilTimeElapsed;
}
// See https://github.com/mifi/SimpleInstaBot/issues/140#issuecomment-1149105387
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);