alexal1 / Insomniac

Instagram bot for automated Instagram interaction using Android device via ADB
https://insomniac-bot.com
MIT License
688 stars 159 forks source link

Error running bot #412

Closed talesam closed 2 years ago

talesam commented 2 years ago

First I got an error asking to install an older version of instagram, I did that and now this error is showing:

Hi! Since of v3.1.0 all core features in this project are free to use.
You may want to get more fine grained control over the bot via these features:
    - Filtering - skip unwanted accounts by various parameters
    - Scrapping - technique that makes interactions significantly safer and faster
    - Warmup - interact with your feed and Explore several minutes before session to behave more like a human
    - Working hours - the script will wait till specified hours before each session
    - Removing mass followers - automate "cleaning" your account
Activate by supporting our small team: https://insomniac-bot.com/activate/

Using insomniac session-manager without extra-features
[12/28 18:10:37] Checking your Internet speed to adjust the script speed, please wait for a minute...
[12/28 18:10:37] (use --no-speed-check to skip this check)
[12/28 18:11:01] Download speed 26.45 Mbit/s, upload speed 13.70 Mbit/s
[12/28 18:11:01] Sleep range will be from 1.33 to 3.66 seconds
Looking for ADB devices...
Connected devices via adb: 1. That's ok.
[12/28 18:11:02] Using uiautomator v2
[12/28 18:11:03] Instagram version: 195.0.0.31.123
[12/28 18:11:04] Sleep time (min) before repeat: 172.50
[12/28 18:11:04] Executing "interact" action.
[12/28 18:11:04] Interaction user amount 7
[12/28 18:11:04] You are using a deprecated limit. The limit new name is called 'successful_interactions_limit_per_source'. Using interactions_count this time. Please switch to that name on next runs.
[12/28 18:11:04] Interactions count: 6
[12/28 18:11:04] Successful interactions limit per source: 70
[12/28 18:11:04] Interactions limit per source: 140
[12/28 18:11:04] You are using a deprecated limit. The limit new name is called 'follow_limit_per_source'. Using 'follow_limit' this time. Please switch to that name on next runs.
[12/28 18:11:04] Follow limit: 1
[12/28 18:11:04] Total likes limit: 57
[12/28 18:11:04] Total interactions limit: 103
[12/28 18:11:04] Total successful-interactions limit: 53
[12/28 18:11:04] Total follow limit: 15
[12/28 18:11:04] Total story-watches limit: 57
[12/28 18:11:04] Total comments limit: 50
[12/28 18:11:04] Total get-profile limit: 300
[12/28 18:11:04] Error - 'Session or Device' object has no attribute '_is_alive'
Traceback (most recent call last):
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/__init__.py", line 1616, in __getattr__
    return getattr(self._default_session, attr)
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/session.py", line 642, in __getattr__
    raise AttributeError(f"Session object has no attribute '{key}'")
AttributeError: Session object has no attribute '_is_alive'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/session.py", line 313, in run
    self.prepare_session_state(args, device_wrapper, app_version, save_profile_info=True)
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/session.py", line 255, in prepare_session_state
    device.wake_up()
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/device_facade.py", line 217, in wake_up
    while not self.is_alive() and attempts < 5:
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/device_facade.py", line 212, in is_alive
    return self.deviceV2._is_alive()
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/__init__.py", line 1618, in __getattr__
    raise AttributeError(
AttributeError: 'Session or Device' object has no attribute '_is_alive'

[12/28 18:11:04] Could not save crash after an error. Crash-save-error: 'Session or Device' object has no attribute '_is_alive'
[12/28 18:11:04] Error - 'Session or Device' object has no attribute '_is_alive'
Traceback (most recent call last):
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/__init__.py", line 1616, in __getattr__
    return getattr(self._default_session, attr)
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/session.py", line 642, in __getattr__
    raise AttributeError(f"Session object has no attribute '{key}'")
AttributeError: Session object has no attribute '_is_alive'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/session.py", line 313, in run
    self.prepare_session_state(args, device_wrapper, app_version, save_profile_info=True)
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/session.py", line 255, in prepare_session_state
    device.wake_up()
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/device_facade.py", line 217, in wake_up
    while not self.is_alive() and attempts < 5:
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/device_facade.py", line 212, in is_alive
    return self.deviceV2._is_alive()
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/__init__.py", line 1618, in __getattr__
    raise AttributeError(
AttributeError: 'Session or Device' object has no attribute '_is_alive'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/__init__.py", line 1616, in __getattr__
    return getattr(self._default_session, attr)
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/session.py", line 642, in __getattr__
    raise AttributeError(f"Session object has no attribute '{key}'")
AttributeError: Session object has no attribute '_is_alive'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/utils.py", line 193, in save_crash
    device.wake_up()
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/device_facade.py", line 217, in wake_up
    while not self.is_alive() and attempts < 5:
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/insomniac/device_facade.py", line 212, in is_alive
    return self.deviceV2._is_alive()
  File "/home/gustavobruna/.local/lib/python3.9/site-packages/uiautomator2/__init__.py", line 1618, in __getattr__
    raise AttributeError(
AttributeError: 'Session or Device' object has no attribute '_is_alive'

[12/28 18:11:04] Close Instagram app com.instagram.android

If you like this bot, please give us a star:
https://github.com/alexal1/Insomniac

-------- FINISH: None --------

Completed sessions: 0
Total duration: 0:00:06.614465
Total interactions: 0
Successful interactions: 0
Total followed : 0
Total likes: 0
Total unfollowed: 0
Total stories watches: 0
Total comments: 0
Total get-profile: 0
Total scraped: 0
Removed mass followers: none

File being used is this:

gustavobruna@theo1802:~/Instagram$ cat interacao.json 
[
  {
    "parameter-name": "device",
    "enabled": false,
    "value": "emulator-5554",
    "description" : "identificador do dispositivo. Deve ser usado apenas quando vários dispositivos estão conectados ao mesmo tempo"
  },
  {
    "parameter-name": "app_id",
    "enabled": false,
    "value": "com.instagram.android",
    "description" : "Identificador do pacote apk. Deve ser usado apenas se você estiver usando o aplicativo clonado. Usando 'com.instagram.android' por padrão"
  },
  {
    "parameter-name": "wait_for_device",
    "enabled": true,
    "value": "True",
    "description" : "continue esperando que o dispositivo ADB esteja pronto para a conexão (se nenhum id de dispositivo for fornecido usando a sinalização --device, irá esperar por qualquer dispositivo disponível)"
  },
  {
    "parameter-name": "dont_indicate_softban",
    "enabled": false,
    "value": "True",
    "description" : "por padrão, a Insomniac tentou indicar se há um softban em sua conta. defina este sinalizador para ignorar os indicadores de soft-ban"
  },
  {
    "parameter-name": "debug",
    "enabled": false,
    "value": "True",
    "description" : "adicione este sinalizador ao insomniac no modo de depuração (registros mais detalhados)"
  },
  {
    "parameter-name": "old",
    "enabled": false,
    "value": "True",
    "description" : "adicione este sinalizador para usar uma versão antiga do uiautomator. Use-o apenas se tiver problemas com a versão padrão"
  },
  {
    "parameter-name": "no_speed_check",
    "enabled": false,
    "value": "True",
    "description" : "pular verificação de velocidade da internet no início"
  },
  {
    "parameter-name": "repeat",
    "enabled": true,
    "value": "160-220",
    "description" : "repita a mesma sessão novamente após N minutos após a conclusão, desativado por padrão. Pode ser um número de minutos (por exemplo, 180) ou um intervalo (por exemplo, 120-180)"
  },
  {
    "parameter-name": "likes_count",
    "enabled": true,
    "value": "1-2",
    "description" : "número de curtidas para cada usuário interagido, 2 por padrão. Pode ser um número (por exemplo, 2) ou um intervalo (por exemplo, 2-4)"
  },
  {
    "parameter-name": "likes_percentage",
    "enabled": true,
    "value": "80",
    "description" : "gosta de determinada porcentagem de usuários interagidos, 100 por padrão"
  },
  {
    "parameter-name": "stories_count",
    "enabled": true,
    "value": "1-2",
    "description" : "número de histórias para assistir para cada usuário, desativado por padrão. Pode ser um número (por exemplo, 2) ou um intervalo (por exemplo, 2-4)"
  },
  {
    "parameter-name": "follow_percentage",
    "enabled": true,
    "value": "7",
    "description" : "segue determinada porcentagem de usuários interagidos, 0 por padrão"
  },
  {
    "parameter-name": "interact",
    "enabled": true,
    "value": [
      "@manudalsico",
      "@biahrodriguesz",
      "@flavia_viana",
      "@jaquekhury",
      "@santanaadriana",
      "@heloisa.bolsonaro",
      "@nossoape.710",
      "@drabiancamello",
      "@gusttavolima"
    ],
    "description" : "lista de hashtags e nomes de usuário. Os nomes de usuário devem começar com o símbolo \\\"@\\\". O script irá interagir com hashtags \\ 'curtidores de posts e com usuários \\' seguidores"
  },
  {
    "parameter-name": "reinteract_after",
    "enabled": false,
    "value": "72-96",
    "description" : "defina um tempo (em horas) para aguardar antes de interagir novamente com um perfil já interagido, desabilitado por padrão (não interagirá novamente). Pode ser um número (por exemplo, 48) ou um intervalo (por exemplo, 50-80)"
  },
  {
    "parameter-name": "interaction_users_amount",
    "enabled": true,
    "value": "6-8",
    "description" : "adicione este argumento para selecionar uma quantidade de usuários da lista de interação (os usuários são randomizados). Pode ser um número (por exemplo, 4) ou um intervalo (por exemplo, 3-8)"
  },
  {
    "parameter-name": "unfollow",
    "enabled": false,
    "value": "20-40",
    "description" : "deixar de seguir no máximo determinado número de usuários. Apenas usuários seguidos por este script deixarão de seguir. A ordem é do mais antigo para o mais novo seguinte. Pode ser um número (por exemplo, 100) ou um intervalo (por exemplo, 100-200)"
  },
  {
    "parameter-name": "min_following",
    "enabled": false,
    "value": "150",
    "description" : "quantidade mínima de seguidores, depois de atingir esta quantidade, parar de seguir"
  },
  {
    "parameter-name": "max_following",
    "enabled": false,
    "value": "150",
    "description" : "quantidade máxima de seguidores, depois de atingir esse valor, as paradas de seguimento. desabilitado por padrão"
  },
  {
    "parameter-name": "unfollow_followed_by_anyone",
    "enabled": false,
    "value": "True",
    "description" : "Por padrão, apenas os perfis seguidos pelo bot deixarão de ser seguidos. Defina este parâmetro se quiser deixar de seguir qualquer perfil (mesmo que não tenha sido seguido pelo bot)"
  },
  {
    "parameter-name": "unfollow_non_followers",
    "enabled": false,
    "value": "True",
    "description" : "deixar de seguir apenas perfis que não estão seguindo você"
  },
  {
    "parameter-name": "total_likes_limit",
    "enabled": true,
    "value": "50-60",
    "description" : "limite na quantidade total de curtidas durante a sessão, 300 por padrão. Pode ser um número apresentando um limite específico (por exemplo, 300) ou um intervalo (por exemplo, 100-120"
  },
  {
    "parameter-name": "total_interactions_limit",
    "enabled": true,
    "value": "100-120",
    "description" : "número total de interações (bem e mal sucedidas) por sessão, desativado por padrão. Pode ser um número (por exemplo, 70) ou um intervalo (por exemplo, 60-80))"
  },
  {
    "parameter-name": "total_successful_interactions_limit",
    "enabled": true,
    "value": "50-60",
    "description" : "número total de interações bem-sucedidas por sessão, desativado por padrão. Pode ser um número (por exemplo, 70) ou um intervalo (por exemplo, 60-80)"
  },
  {
    "parameter-name": "total_follow_limit",
    "enabled": true,
    "value": "15-20",
    "description" : "limite na quantidade total de seguidores durante a sessão, desativado por padrão. Pode ser um número (por exemplo, 27) ou um intervalo (por exemplo, 20-30)"
  },
  {
    "parameter-name": "interactions_count",
    "enabled": true,
    "value": "6-8",
    "description" : "número de interações por cada blogger / hashtag, 70 por padrão. Pode ser um número (por exemplo, 70) ou um intervalo (por exemplo, 60-80). Apenas as interações bem-sucedidas contam"
  },
  {
    "parameter-name": "follow_limit",
    "enabled": true,
    "value": "1-2",
    "description" : "limite na quantidade de seguidores durante a interação com os seguidores de cada um dos usuários, desativado por padrão. Pode ser um número (por exemplo, 10) ou um intervalo (por exemplo, 6-9)"
  },
  {
    "parameter-name": "total_story_limit",
    "enabled": true,
    "value": "50-60",
    "description" : "limite na quantidade total de relógios de história durante a sessão, desativado por padrão. Pode ser um número (por exemplo, 27) ou um intervalo (por exemplo, 20-30)"
  },
  {
    "parameter-name": "total_get_profile_limit",
    "enabled": true,
    "value": "300-400",
    "description" : "limite na quantidade total de ações get-profile durante a sessão, desabilitado por padrão. Pode ser um número (por exemplo, 600) ou um intervalo (por exemplo, 500-700)"
  },
  {
    "parameter-name": "session_length_in_mins_limit",
    "enabled": false,
    "value": "50-60",
    "description" : "limitar a duração da sessão por tempo (minutos), desativado por padrão. Pode ser um número (por exemplo, 60) ou um intervalo (por exemplo, 40-70)"
  }
]
talesam commented 2 years ago

I tested it on another device:

[talesam@neit Instagram]$ python start.py --config-file interacao.json

##########################################################
#                                                        #
#   _____                                 _              #
#  |_   _|                               (_)             #
#    | |  _ __  ___  ___  _ __ ___  _ __  _  __ _  ___   #
#    | | | '_ \/ __|/ _ \| '_ ` _ \| '_ \| |/ _` |/ __|  #
#   _| |_| | | \__ \ (_) | | | | | | | | | | (_| | (__   #
#  |_____|_| |_|___/\___/|_| |_| |_|_| |_|_|\__,_|\___|  #
#                                                        #
##########################################################

Engine v3.7.28

Hi! Since of v3.1.0 all core features in this project are free to use.
You may want to get more fine grained control over the bot via these features:
    - Filtering - skip unwanted accounts by various parameters
    - Scrapping - technique that makes interactions significantly safer and faster
    - Warmup - interact with your feed and Explore several minutes before session to behave more like a human
    - Working hours - the script will wait till specified hours before each session
    - Removing mass followers - automate "cleaning" your account
Activate by supporting our small team: https://insomniac-bot.com/activate/

Using insomniac session-manager without extra-features
[12/29 19:22:15] Checking your Internet speed to adjust the script speed, please wait for a minute...
[12/29 19:22:15] (use --no-speed-check to skip this check)
[12/29 19:22:39] Download speed 25.37 Mbit/s, upload speed 10.85 Mbit/s
[12/29 19:22:39] Sleep range will be from 1.46 to 3.92 seconds
Looking for ADB devices...
Connected devices via adb: 1. That's ok.
Unknown input method com.alexal1.adbkeyboard/.AdbIME cannot be selected for user #0
[12/29 19:22:40] Cannot setup ADB Keyboard. Don't worry! Fallback to text copy-pasting will be used.
[12/29 19:22:40] Using uiautomator v2
[I 211229 19:22:40 init:155] uiautomator2 version: 2.7.3
[12/29 19:22:41] Instagram version: 195.0.0.31.123
[12/29 19:22:42] Sleep time (min) before repeat: 169.71
[12/29 19:22:42] Executing "interact" action.
[12/29 19:22:42] Interaction user amount 8
[12/29 19:22:42] interaction-users-amount parameter is equal or higher then the users-interact list. Choosing all list for interaction.
[12/29 19:22:42] Successful interactions limit per source: 7
[12/29 19:22:42] Interactions limit per source: 140
[12/29 19:22:42] Follow limit: 2
[12/29 19:22:42] Total likes limit: 57
[12/29 19:22:42] Total interactions limit: 118
[12/29 19:22:42] Total successful-interactions limit: 56
[12/29 19:22:42] Total follow limit: 16
[12/29 19:22:42] Total story-watches limit: 57
[12/29 19:22:42] Total comments limit: 50
[12/29 19:22:42] Total get-profile limit: 360
Traceback (most recent call last):
  File "/home/talesam/.local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 1616, in __getattr__
    return getattr(self._default_session, attr)
  File "/home/talesam/.local/lib/python3.10/site-packages/uiautomator2/session.py", line 642, in __getattr__
    raise AttributeError(f"Session object has no attribute '{key}'")
AttributeError: Session object has no attribute '_is_alive'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/talesam/.local/lib/python3.10/site-packages/insomniac/session.py", line 313, in run
    self.prepare_session_state(args, device_wrapper, app_version, save_profile_info=True)
  File "/home/talesam/.local/lib/python3.10/site-packages/insomniac/session.py", line 255, in prepare_session_state
    device.wake_up()
  File "/home/talesam/.local/lib/python3.10/site-packages/insomniac/device_facade.py", line 217, in wake_up
    while not self.is_alive() and attempts < 5:
  File "/home/talesam/.local/lib/python3.10/site-packages/insomniac/device_facade.py", line 212, in is_alive
    return self.deviceV2._is_alive()
  File "/home/talesam/.local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 1618, in __getattr__
    raise AttributeError(
AttributeError: 'Session or Device' object has no attribute '_is_alive'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/talesam/Servidor/Instagram/start.py", line 4, in <module>
    insomniac.run(activation_code)
  File "/home/talesam/.local/lib/python3.10/site-packages/insomniac/__init__.py", line 33, in run
    insomniac_session.run()
  File "/home/talesam/.local/lib/python3.10/site-packages/insomniac/session.py", line 345, in run
    print(COLOR_FAIL + describe_exception(ex) + COLOR_ENDC)
  File "/home/talesam/.local/lib/python3.10/site-packages/insomniac/utils.py", line 370, in describe_exception
    trace = ''.join(traceback.format_exception(etype=type(ex), value=ex, tb=ex.__traceback__)) if with_stacktrace else ''
TypeError: format_exception() got an unexpected keyword argument 'etype'
gtcdevop commented 2 years ago

Following, uiautomator2 have changed their api on Python 3.10 making those methods private https://github.com/openatx/uiautomator2/blob/a6ebc2446a8babb4ce14dc62cfdb5590ea95c709/uiautomator2/__init__.py#L1605

now we have to change the way we check https://github.com/alexal1/Insomniac/blob/1d5f0e871fdd9b1cdc7f3c3ac3929f88bcc69e1b/insomniac/device_facade.py#L208-L212 I'm working on it

gtcdevop commented 2 years ago

Maintainers fix is in here https://github.com/alexal1/Insomniac/pull/415

alexal1 commented 2 years ago

Fixed in v3.8.2