iSarabjitDhiman / TweeterPy

TweeterPy is a python library to extract data from Twitter. TweeterPy API lets you scrape data from a user's profile like username, userid, bio, followers/followings list, profile media, tweets, etc.
MIT License
164 stars 29 forks source link

Couldn't find guest token #59

Closed PetRockMiner closed 6 months ago

PetRockMiner commented 6 months ago

xxxxx@xxxxxxx:~/TweeterPy$ python3 quickstart.py 2024-05-17 23:33:39,525 [ERROR] :: Couldn't find guest token 2024-05-17 23:33:39,525 [ERROR] :: Couldn't generate a new session. Couldn't find guest token Traceback (most recent call last): File "/home/xxxxxx/TweeterPy/tweeterpy/tweeterpy.py", line 162, in generate_session Path.GUEST_TOKEN_URL, method="POST", session=self.session).get('guest_token', util.find_guest_token(home_page)) File "/home/xxxxxx/TweeterPy/tweeterpy/util.py", line 92, in find_guest_token raise Exception("Couldn't find guest token") Exception: Couldn't find guest token Traceback (most recent call last): File "quickstart.py", line 20, in main() File "quickstart.py", line 9, in main twitter = TweeterPy() File "/home/xxxxxx/TweeterPy/tweeterpy/tweeterpy.py", line 29, in init self.generate_session() File "/home/xxxxxx/TweeterPy/tweeterpy/tweeterpy.py", line 162, in generate_session Path.GUEST_TOKEN_URL, method="POST", session=self.session).get('guest_token', util.find_guest_token(home_page)) File "/home/xxxxxx/TweeterPy/tweeterpy/util.py", line 92, in find_guest_token raise Exception("Couldn't find guest token") Exception: Couldn't find guest token

also in tweeterpy.py there are some typos, lines 71-73

                varaibles = json.loads(params['variables'])
                varaibles['cursor'] = end_cursor
                params['variables'] = json.dumps(varaibles)
zxj0302 commented 6 months ago

I encountered exactly the same error.

iSarabjitDhiman commented 6 months ago

Hey @zxj0302 @PetRockMiner Recently, Twitter changed all of its URLs from twitter.com to X.com But I already fixed it yesterday. Please check this issue #58 and update the package


pip install -U tweeterpy --no-cache-dir

Feel free to close the issue if it's resolved. If you still get this error message, let me know.

Thanks.

Duplicate : #58

New-dev0 commented 6 months ago

On updating the tweeterpy, error doesn't get resolved. In fact, I have installed the Library today only Also tried installing from git Still same error

iSarabjitDhiman commented 6 months ago

On updating the tweeterpy, error doesn't get resolved. In fact, I have installed the Library today only Also tried installing from git Still same error

Thanks for the update @New-dev0 I will take a look at it shortly and let u know once it is fixed.

zxj0302 commented 6 months ago

On updating the tweeterpy, error doesn't get resolved. In fact, I have installed the Library today only Also tried installing from git Still same error

Thanks for the update @New-dev0 I will take a look at it shortly and let u know once it is fixed.

Yes, the same situation with @New-dev0. And I was wondering whether and how I can know when a tweet is retweeted. I can use get_retweeters() to get all the users retweet a tweet, but how can i know when this occurs? This is very important for my research and I will be very appreciated if you can give me some tips or hints. Thank you❤️

iSarabjitDhiman commented 6 months ago

Hey everyone, just made some changes to the code. Please update the package, test it and keep me posted.

Thank you.

Edit: @PetRockMiner just fixed the typos. Thanks for pointing them out.

iSarabjitDhiman commented 6 months ago

On updating the tweeterpy, error doesn't get resolved. In fact, I have installed the Library today only Also tried installing from git Still same error

Thanks for the update @New-dev0 I will take a look at it shortly and let u know once it is fixed.

Yes, the same situation with @New-dev0. And I was wondering whether and how I can know when a tweet is retweeted. I can use get_retweeters() to get all the users retweet a tweet, but how can i know when this occurs? This is very important for my research and I will be very appreciated if you can give me some tips or hints. Thank you❤️

Hey @zxj0302 I am not sure if that's possible. You gonna have to check it manually by using the get_retweeters() method.

zxj0302 commented 6 months ago

On updating the tweeterpy, error doesn't get resolved. In fact, I have installed the Library today only Also tried installing from git Still same error

Thanks for the update @New-dev0 I will take a look at it shortly and let u know once it is fixed.

Yes, the same situation with @New-dev0. And I was wondering whether and how I can know when a tweet is retweeted. I can use get_retweeters() to get all the users retweet a tweet, but how can i know when this occurs? This is very important for my research and I will be very appreciated if you can give me some tips or hints. Thank you❤️

Hey @zxj0302 I am not sure if that's possible. You gonna have to check it manually by using the get_retweeters() method.

Thank you!

PetRockMiner commented 6 months ago

working great now! thank you!