#1433·twint

[ERROR] twint.token.RefreshTokenException: Could not find the Guest token in HTML

Author: michaelmorenoCreated Mar 3, 2023Updated Mar 14, 2023

Attempting to run a trivial user search

python
import twint

c = twint.Config()
c.Username = "elonmusk"
c.User_full = True
c.Store_object = True
c.Hide_output = True
twint.run.Lookup(c)

Raising Exception Could not find the Guest token in HTML

bash
Traceback (most recent call last):
  File "/Users/michaelmoreno/proj/twitter-api/src/main.py", line 20, in <module>
    twint.run.Lookup(c)
  File "/Users/michaelmoreno/proj/twitter-api/venv/src/twint/twint/run.py", line 386, in Lookup
    run(config)
  File "/Users/michaelmoreno/proj/twitter-api/venv/src/twint/twint/run.py", line 329, in run
    get_event_loop().run_until_complete(Twint(config).main(callback))
                                        ^^^^^^^^^^^^^
  File "/Users/michaelmoreno/proj/twitter-api/venv/src/twint/twint/run.py", line 36, in __init__
    self.token.refresh()
  File "/Users/michaelmoreno/proj/twitter-api/venv/src/twint/twint/token.py", line 69, in refresh
    raise RefreshTokenException('Could not find the Guest token in HTML')
twint.token.RefreshTokenException: Could not find the Guest token in HTML

Python Version: 3.11 pip version: 23.0.1 twint version: 2.1.21 OS: MacOS Montery 12.6 (M2)

I have tried installing twint both through pip install twint and pip install --upgrade -e git+https://github.com/twintproject/twint.git@origin/master#egg=twint

Output of pip list

bash
aiodns             3.0.0
aiohttp            3.8.4
aiohttp-socks      0.8.0
aiosignal          1.3.1
async-timeout      4.0.2
attrs              22.2.0
beautifulsoup4     4.11.2
bs4                0.0.1
cchardet           2.1.7
certifi            2022.12.7
cffi               1.15.1
charset-normalizer 3.0.1
Cython             0.29.33
dataclasses        0.6
elastic-transport  8.4.0
elasticsearch      8.6.2
fake-useragent     1.1.1
frozenlist         1.3.3
geographiclib      2.0
geopy              2.3.0
googletransx       2.4.2
idna               3.4
multidict          6.0.4
numpy              1.24.2
pandas             1.5.3
pip                23.0.1
pycares            4.3.0
pycparser          2.21
PySocks            1.7.1
python-dateutil    2.8.2
python-socks       2.1.1
pytz               2022.7.1
requests           2.28.2
schedule           1.1.0
setuptools         67.4.0
six                1.16.0
soupsieve          2.4
twint              2.1.21    /Users/michaelmoreno/proj/twitter-api/venv/src/twint
urllib3            1.26.14
yarl               1.8.2