d60 / twikit

Twitter API Scraper | Without an API key | Twitter Internal API | Free | Twitter scraper | Twitter Bot
https://twikit.readthedocs.io/en/latest/twikit.html
MIT License
1.19k stars 133 forks source link

Incorrect. Please try again. #181

Open zaozao1231 opened 1 month ago

zaozao1231 commented 1 month ago

Has anyone encountered this problem? I encountered this problem when trying to log in using the latest code. I am pretty sure that my login information is correct because I successfully logged in with the same configuration in the previous code.

nekoniii3 commented 4 weeks ago

I got "BadRequest: status: 400, message: "{"errors":[{"code":366,"message":"flow name LoginFlow is currently not accessible"}]}"

d60 commented 4 weeks ago

@nekoniii3 Try this. https://github.com/d60/twikit/issues/169#issuecomment-2286465397

nekoniii3 commented 4 weeks ago

Thank you.

This time I got "KeyError: 'open_account'" Maybe it's because it's Google Colab. I will try it in other environments as well!

AritzUMA commented 4 weeks ago

same for mi


runfile('C:/Proyectos/Monitoreo de Grupos de Interés Twitter/Lobby_Spain_Twitter.py', wdir='C:/Proyectos/Monitoreo de Grupos de Interés Twitter')
Artxiboaren pasahitza 'LobbySpain.json' ez dago, berriro sartu behar da.
Traceback (most recent call last):

  File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File c:\proyectos\monitoreo de grupos de interés twitter\lobby_spain_twitter.py:287
    asyncio.run(main())

  File ~\anaconda3\Lib\site-packages\nest_asyncio.py:35 in run
    return loop.run_until_complete(task)

  File ~\anaconda3\Lib\site-packages\nest_asyncio.py:90 in run_until_complete
    return f.result()

  File ~\anaconda3\Lib\asyncio\futures.py:203 in result
    raise self._exception.with_traceback(self._exception_tb)

  File ~\anaconda3\Lib\asyncio\tasks.py:267 in __step
    result = coro.send(None)

  File c:\proyectos\monitoreo de grupos de interés twitter\lobby_spain_twitter.py:54 in main
    await client.login(

  File ~\anaconda3\Lib\site-packages\twikit\client\client.py:391 in login
    self._user_id = flow.response['subtasks'][0]['open_account']['user']['id_str']

KeyError: 'open_account'
yuyu1815 commented 4 weeks ago

code

import asyncio
from twikit import Client

# 第一引数に言語を指定
client = Client(user_agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 14_6_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15')

async def main():
    # アカウントにログイン
    await client.login(
        auth_info_1='test',
        auth_info_2='test1@gmail.com',
        password='egggg'
    )
    client.save_cookies('cookies.json')
asyncio.run(main())

error

Traceback (most recent call last):
  File "D:\python\fastApiProject\test.py", line 15, in <module>
    asyncio.run(main())
  File "C:\Users\yuyu\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\yuyu\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "D:\python\fastApiProject\test.py", line 9, in main
    await client.login(
  File "D:\python\fastApiProject\.venv\lib\site-packages\twikit\client\client.py", line 381, in login
    await flow.execute_task({
  File "D:\python\fastApiProject\.venv\lib\site-packages\twikit\utils.py", line 88, in execute_task
    response, _ = await self._client.v11.onboarding_task(
  File "D:\python\fastApiProject\.venv\lib\site-packages\twikit\client\v11.py", line 85, in onboarding_task
    return await self.base.post(
  File "D:\python\fastApiProject\.venv\lib\site-packages\twikit\client\client.py", line 171, in post
    return await self.request('POST', url, **kwargs)
  File "D:\python\fastApiProject\.venv\lib\site-packages\twikit\client\client.py", line 145, in request
    raise BadRequest(message, headers=response.headers)
twikit.errors.BadRequest: status: 400, message: "{"errors":[{"code":366,"message":"flow name LoginFlow is currently not accessible"}]}"
stschatz45 commented 3 weeks ago

I have the same issue. If I use a different account it works fine.

nekoniii3 commented 3 weeks ago

'open_account' Once I logged in from the browser, the problem was resolved. (It seems that the account was considered suspicious because you were asked to enter your email address.) Thank you.