mifi / instauto

Instagram bot / automation library written in Javascript for Node.js
797 stars 145 forks source link

Timeout exceeded while waiting for event #115

Closed belqit closed 2 years ago

belqit commented 2 years ago

image

the bot crashes on startup, it says that it can't reach my ig page, but i can see my ig page on google chrome

instauto 9.1.9

mifi commented 2 years ago

Hi. Can you try to set your own Bio (profile) on your account, to something. see if that helps

belqit commented 2 years ago

already did it.

it fails here: image that api is not called

mifi commented 2 years ago

Hmm. yes. I can reproduce the problem. also the Bio fix did not work for me etiher. For some reason instagram doesn't send this request when running in puppeteer. When opening the page on my normal chrome (same user), it works.

I tried:

Not sure why it's not sending that request...

belqit commented 2 years ago

this is my fix

async function navigateToUserAndGetData(username) {
  const cachedUserData = userDataCache[username];

  if (isAlreadyOnUserPage(username)) {
    // assume we have data
    return cachedUserData;
  }

  if (cachedUserData != null) {
    // if we already have userData, just navigate
    await navigateToUserWithCheck(username);
    return cachedUserData;
  }

  await navigateToUserWithCheck(username);

  var body = await page.content()
  const r = body.split(/\r?\n/);
  var userData;
  for (var q of r) {
    if (q.includes("edge_followed_by")) {
      q = q.split(",[],[")[1]
      q = q.split("]]]")[0]
      q = JSON.parse(q)
      q = q.data.__bbox.result.response
      q = q.replace(/\\/g, "");
      q = JSON.parse(q);
      userData = q.data.user
      break;
    }
  }

  userDataCache[username] = userData;
  return userData;
}
mifi commented 2 years ago

not sure how that works. I cannot find edge_followed_by in my html

belqit commented 2 years ago

I have it.

Did you check on your profile page html?

mifi commented 2 years ago

yes. instagram.com/myaccount are you using mobile or desktop User agent?

belqit commented 2 years ago

Desktop, I didn't change my user agent

Il ven 29 lug 2022, 18:14 Mikael Finstad @.***> ha scritto:

yes. instagram.com/myaccount are you using mobile or desktop User agent?

— Reply to this email directly, view it on GitHub https://github.com/mifi/instauto/issues/115#issuecomment-1199646163, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKRQPHPWH6BWZQTRCCCLK4TVWP7MPANCNFSM55AIOO2A . You are receiving this because you authored the thread.Message ID: @.***>

mifi commented 2 years ago

I have two accounts. One works with instauto and the other one gets Timeout. (doesn't sent the web_profile_info request). I did notice a difference:

so I'm thinking instagram gives different users different versions of the frontend code. and the new version no longer sends the web_profile_info request

belqit commented 2 years ago

i have tierOne,tierTwo and tierThree. the edge_followed_by part is between tierTwo and tierThree, it starts with requireLazy(["JSScheduler","ServerJS","ScheduledApplyEach"],function(JSSch...

mifi commented 2 years ago

I tried your JS and it seems to work on our own profile, but when navigating to other accounts, the edge_followed_by doesn't seem to exist in the HTML. did you find any workaround for that?

belqit commented 2 years ago

for me is working on others profile page too, every profile page have a different json.

mifi commented 2 years ago

I have combined your solution with some other workarounds, and that seems to work. releasing a new version.