0

I need a way to not be see as a boot by instagram in order to avoid the 401 error by the intagram server this code is a leed generator that looks for posts with a certain hashtag and collects the user, follow details the code below.

import instaloader

def encontrar_perfis_interessados(tag):
\# Cria uma instância do Instaloader
loader = instaloader.Instaloader()

    count = 0
    
    # Percorre as postagens recentes com a hashtag fornecida
    for post in instaloader.Hashtag.from_name(loader.context, tag).get_posts():
        username = post.owner_profile.username
        print("Perfil encontrado: @{}".format(username))
        
        # Incrementa o contador de perfis encontrados
        count += 1
    
        # Verifica se atingiu o limite de 25 perfis encontrados
        if count >= 25:
            break

encontrar_perfis_interessados("alfajours")'
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\instaloader\instaloadercontext.py", line 352, in get_json
    raise ConnectionException("HTTP error code {}.".format(resp.status_code))
instaloader.exceptions.ConnectionException: HTTP error code 401.
Tim Roberts
  • 48,973
  • 4
  • 21
  • 30
  • 1
    401 means access denied, which usually means your credentials (username/password) are wrong. – John Gordon Aug 15 '23 at 00:27
  • Please show us the full code, and the full error traceback message. – John Gordon Aug 15 '23 at 00:28
  • import instaloader def encontrar_perfis_interessados(tag): # Cria uma instância do Instaloader loader = instaloader.Instaloader() count = 0 username = post.owner_profile.username print("Perfil encontrado: @{}".format(username)) count += 1 if count >= 25: break encontrar_perfis_interessados("alfajours") – joao paulo Aug 15 '23 at 00:48
  • line 352, in get_json raise ConnectionException("HTTP error code {}.".format(resp.status_code)) instaloader.exceptions.ConnectionException: HTTP error code 401. – joao paulo Aug 15 '23 at 00:49
  • Please edit the question and put the code and error message there. It's very hard to read code in a comment. – John Gordon Aug 15 '23 at 00:49
  • 1
    But you ARE a bot. They are specifically trying to prevent people from doing what you are doing -- stealing their copyrighted information. You can try specifying a `user_agent` parameter, but they'll always be one step ahead. – Tim Roberts Aug 15 '23 at 01:02

0 Answers0