Osintgram icon indicating copy to clipboard operation
Osintgram copied to clipboard

Instagram Blocking Requests [SOLVED]

Open adyrol opened this issue 3 years ago • 8 comments

Osintgram.txt I came across an issue where my sessions were being closed out when I try to get a large amount of target followers/emails/phone numbers. I'm sure a lot of people experienced this too so I took a look at the source code

in src/Osintgram.py line 331 for get_followers:

    while next_max_id:

        sys.stdout.write("\rCatched %i followers" % len(_followers))
        sys.stdout.flush()
        results = self.api.user_followers(str(self.target_id), rank_token=rank_token, max_id=next_max_id)
        _followers.extend(results.get('users', []))
        next_max_id = results.get('next_max_id')

So I imported the time and random libraries to create pauses between scrapes (if you're familiar with nmap it's the same idea as scan delay).

    counter = 0
    
    while next_max_id:

       # Sleeps between Scrapes
       counter += 1
       if counter == 3: 
           min_sleep = 5 * 60
           max_sleep = 15 * 60
           time.sleep(random.randrange(min_sleep,max_sleep))
           counter = 0
        
        # And I Added a limiter for some bigger accounts I came across
        if len(_followers) > 20000:
            break
                                                   
        sys.stdout.write("\rCatched %i followers" % len(_followers))
        sys.stdout.flush()
        results = self.api.user_followers(str(self.target_id), rank_token=rank_token, max_id=next_max_id)
        _followers.extend(results.get('users', []))
        next_max_id = results.get('next_max_id')

Around lines 1577 in get_fwersnumber it's the same concept just changing a few variables around

        counter = 0

        for follow in followings:

            #counter and sleep
            counter += 1
            if counter == 4:
                time.sleep(70)
                counter = 0
            if len(results) > 1500:
                break



            sys.stdout.write("\rCatched %i followers phone numbers" % len(results))
            sys.stdout.flush()
            user = self.api.user_info(str(follow['id']))
            if 'contact_phone_number' in user['user'] and user['user']['contact_phone_number']:
                follow['contact_phone_number'] = user['user']['contact_phone_number']
                if len(results) > value:
                    break
                results.append(follow)

adyrol avatar Dec 31 '22 09:12 adyrol

@adyrol Ur code seems not to work to me, displaying "counter = 0 indentationerror: unexpected indent"

djukavrabac avatar Dec 31 '22 20:12 djukavrabac

Or can u myb paste here whole file so i can copy & paste it into my src

djukavrabac avatar Dec 31 '22 20:12 djukavrabac

@djukavrabac okay I have it up - just rename the filetype from .txt to .py

adyrol avatar Dec 31 '22 20:12 adyrol

Ty mate. But not happening anything cuz i have problem with the request i posted on my issue.

djukavrabac avatar Dec 31 '22 20:12 djukavrabac

I have the same problem when I try to get a small number of targeted followers/emails/phone calls and an instagram account lockout occurs

Run a command: fwersemail Searching for emails of target followers... this can take a few minutes Catched 200 followers email

Do you want to get all emails? y/n: n How many emails do you want to get? 30 Traceback (most recent call last): File "/home/csi/.local/lib/python3.10/site-packages/instagram_private_api/client.py", line 523, in _call_api response = self.opener.open(req, timeout=self.timeout) File "/usr/lib/python3.10/urllib/request.py", line 525, in open response = meth(req, response) File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response response = self.parent.error( File "/usr/lib/python3.10/urllib/request.py", line 563, in error return self._call_chain(*args) File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 401: Unauthorized

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/csi/Desktop/Osint/Osintgram/main.py", line 186, in _cmd() File "/home/csi/Desktop/Osint/Osintgram/src/Osintgram.py", line 1238, in get_fwersemail user = self.api.user_info(str(follow['id'])) File "/home/csi/.local/lib/python3.10/site-packages/instagram_private_api/endpoints/users.py", line 17, in user_info res = self._call_api('users/{user_id!s}/info/'.format(**{'user_id': user_id})) File "/home/csi/.local/lib/python3.10/site-packages/instagram_private_api/client.py", line 527, in _call_api ErrorHandler.process(e, error_response) File "/home/csi/.local/lib/python3.10/site-packages/instagram_private_api/errors.py", line 135, in process raise ClientError(error_msg, http_error.code, error_response) instagram_private_api.errors.ClientError: Unauthorized: Please wait a few minutes before you try again.

shanow7 avatar Jan 01 '23 13:01 shanow7

Well same happened to me. So this isn't sloved. @Datalux need to fix this. I can't even catch user with only 200+ or 300+ their numbers, emails. That's sad.

djukavrabac avatar Jan 03 '23 16:01 djukavrabac

I'm getting the same instagram_private_api error and none of my scrapes work at all. Osintgram has been totally useless can't scrape anything

1qaz0okm avatar Jan 05 '23 18:01 1qaz0okm

Same error here. Osintgram can't scrape anything.

Kadaber avatar Jan 07 '23 22:01 Kadaber