vladkens / twscrape

2024! X / Twitter API scrapper with authorization support. Allows you to scrape search results, User's profiles (followers/following), Tweets (favoriters/retweeters) and more.
https://pypi.org/project/twscrape/
MIT License
793 stars 104 forks source link

Response status when Accounts is banned or session Expired #142

Open 0xGhostCasper opened 3 months ago

0xGhostCasper commented 3 months ago

Hi, @vladkens !

I thought it would be super useful to return some kind of Command or Query result objects from method calls with success status codes and error reasons instead of just returning None values in case of expired session or banned account, because right now we cannot spot and react to situations when account gets banned or session expires - we only see debug logs and that's it, this is not helping to manage application flow.

I believe this should be useful for others aswell, I believe I already saw such suggestion before here in issues section.

sicholas commented 3 months ago

137 This is what was causing my scripts to never grab full following. Would hit a banned account and would just stop the gather function.

sicholas commented 3 months ago
Screenshot 2024-03-29 at 1 12 49 PM

Got it to work by editing the queue_client.py code, was truly never catching the banned 403 error. This implementation has it simply removes the account and places it in inactive status. Let me know if that helps! @0xGhostCasper