how to resolve request error in this code

170 Views Asked by At

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.
0

There are 0 best solutions below