Skip to content

Instantly share code, notes, and snippets.

@ahmedbesbes
Last active May 16, 2022 10:14
Show Gist options
  • Save ahmedbesbes/ea203dc1a52f7c6361d44952dca32160 to your computer and use it in GitHub Desktop.
Save ahmedbesbes/ea203dc1a52f7c6361d44952dca32160 to your computer and use it in GitHub Desktop.
import os
import tweepy
from dotenv import load_dotenv
load_dotenv()
bearer_token = os.environ["BEARER_TOKEN"]
class MyStreamer(tweepy.StreamingClient):
def on_tweet(self, tweet):
print(tweet.id)
print(tweet.text)
print("======")
streamer = MyStreamer(bearer_token)
streamer.add_rules(tweepy.StreamRule("ukraine lang:en"))
streamer.filter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment