fix string
This commit is contained in:
parent
556b6fb93b
commit
9da39014fc
1 changed files with 5 additions and 4 deletions
9
main.py
9
main.py
|
@ -57,15 +57,16 @@ def cleanTweet(tweet: str) -> str:
|
||||||
|
|
||||||
class Listener(StreamListener):
|
class Listener(StreamListener):
|
||||||
"""Watch for tweets that match criteria in real-time."""
|
"""Watch for tweets that match criteria in real-time."""
|
||||||
def __init__(self, api = None, users = None, q = Queue()):
|
def __init__(self, api = None, users = None, forcelist = None, q = Queue()):
|
||||||
super(Listener, self).__init__()
|
super(Listener, self).__init__()
|
||||||
self.q = q
|
self.q = q
|
||||||
self.api = api
|
self.api = api
|
||||||
self.users = users
|
self.accounts = users
|
||||||
|
self.users = users + forcelist
|
||||||
self.listOfFriendsID = getFriendsID(api, users)
|
self.listOfFriendsID = getFriendsID(api, users)
|
||||||
|
|
||||||
def on_connect(self):
|
def on_connect(self):
|
||||||
print(f"Scroll sur Twitter avec les abonnements de @{', @'.join(self.users)} comme timeline...")
|
print(f"Scroll sur Twitter avec les abonnements de @{', @'.join(self.accounts)} comme timeline...")
|
||||||
|
|
||||||
def on_disconnect(notice):
|
def on_disconnect(notice):
|
||||||
notice = notice["disconnect"]
|
notice = notice["disconnect"]
|
||||||
|
@ -191,7 +192,7 @@ def start():
|
||||||
whitelist = f"@{', @'.join(keys['WHITELIST'])}"
|
whitelist = f"@{', @'.join(keys['WHITELIST'])}"
|
||||||
print(f"Liste des comptes ignorés : {whitelist}.")
|
print(f"Liste des comptes ignorés : {whitelist}.")
|
||||||
|
|
||||||
listener = Listener(api, keys["PSEUDOS"] + keys["FORCELIST"])
|
listener = Listener(api, keys["PSEUDOS"], keys["FORCELIST"])
|
||||||
stream = Stream(auth = api.auth, listener = listener)
|
stream = Stream(auth = api.auth, listener = listener)
|
||||||
stream.filter(track = triggerWords, languages = ["fr"], stall_warnings = True, is_async = True)
|
stream.filter(track = triggerWords, languages = ["fr"], stall_warnings = True, is_async = True)
|
||||||
|
|
||||||
|
|
Reference in a new issue