twintproject / twint

An advanced Twitter scraping & OSINT tool written in Python that doesn't use Twitter's API, allowing you to scrape a user's followers, following, Tweets and more while evading most API limitations.
MIT License
15.68k stars 2.71k forks source link

HELP!!! Could not find the Guest token in HTML! #1324

Open LUCKLIKECLOUD opened 2 years ago

LUCKLIKECLOUD commented 2 years ago

Issue

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/bin/twint", line 33, in sys.exit(load_entry_point('twint==2.1.21', 'console_scripts', 'twint')()) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/twint/cli.py", line 339, in run_as_command main() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/twint/cli.py", line 330, in main run.Search(c) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/twint/run.py", line 410, in Search run(config, callback) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/twint/run.py", line 329, in run get_event_loop().run_until_complete(Twint(config).main(callback)) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/twint/run.py", line 36, in init self.token.refresh() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/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

Initial Check

Description of Issue

Haven't been able to mine data on Twitter

Environment Details

Using macOS 11.6 Terminal Using Python version is 3.9.9 Using VPN(Based in China)

StuartRucker commented 2 years ago

Same as https://github.com/twintproject/twint/issues/1320. It looks like it might be a recent issue. Also getting this on ubuntu VM, and mac with no VPN

xXedwardXx commented 2 years ago

It looks like this amendment to the token.py file fixes the issue:

https://github.com/twintproject/twint/issues/1320#issuecomment-1007828229

MirunaClinciu commented 2 years ago

Overwrite "token.py" with this => https://github.com/Museum-Barberini/twint/edit/fix/RefreshTokenException/twint/token.py

  1. My first step was to install/reinstall twint which failed.

  2. After I used the following libraries (not sure if it was useful): import nest_asyncio nest_asyncio.apply() import twint import requests res = requests.get('https://twitter.com') print(res.text.split('\n')[-1])

  3. I installed a VPN (ProtonVPN), not sure if it was the best one etc and I am open to other suggestions.

  4. I overwrite the file token.py with a different version. The one that I shared here worked.

Meenu-Jain commented 2 years ago

for me not working either