Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TokenExpiryException: Rate limit exceeded #1

Open
batmanscode opened this issue May 14, 2023 · 0 comments
Open

TokenExpiryException: Rate limit exceeded #1

batmanscode opened this issue May 14, 2023 · 0 comments

Comments

@batmanscode
Copy link

Following up from: woluxwolu#14 (comment)

Any long keyword search or username scrape results in TokenExpiryException: Rate limit exceeded.

Notes:

  • Installed with: pip install git+https://github.com/catgirl-v/twint.git (also tried git+...twint.git@fix-search)
  • Used both python 3.9 and 3.10 in a jupyter notebook

Code sample:

import os
import twint
import datetime 
import dateutil.relativedelta

os.environ["TWITTER_AUTH_TOKEN"] = "1234"

last_month = datetime.date.today() + dateutil.relativedelta.relativedelta(weeks=-4)

search = ["btc", "bitcoin"]

# if using in jupyter, the following might be needed
# import nest_asyncio
# nest_asyncio.apply()

for item in search:
    c = twint.Config()
    c.Utc = True
    c.Full_text = True
    c.Search = item
    c.Stats = False
    c.Min_likes = 20
    c.Since = str(last_month)
    c.Popular_tweets = False
    c.Custom["tweet"] = ["id", "conversation_id", "created_at", "date", "time", "username", "user_id", "name", "tweet", "language",\
      "retweet", "quote_url", "likes_count", "retweets_count", "replies_count",\
      "mentions", "urls", "photos", "video", "hashtags", "cashtags", "reply_to", "link"]
    c.Output = "btc.csv"
    c.Store_csv = True
    c.Min_wait_time = 120
    
    twint.run.Search(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant