update comment
This commit is contained in:
parent
b1c5abe1f9
commit
6eab4a41b3
1 changed files with 3 additions and 2 deletions
5
main.py
5
main.py
|
@ -87,7 +87,7 @@ class Listener(StreamingClient):
|
||||||
def on_connect(self):
|
def on_connect(self):
|
||||||
print(f"Début du scroll sur Twitter...")
|
print(f"Début du scroll sur Twitter...")
|
||||||
|
|
||||||
def get_user(self, uid: int) -> str:
|
def _get_user(self, uid: int) -> str:
|
||||||
"""Return username by ID, with cache support"""
|
"""Return username by ID, with cache support"""
|
||||||
# If not cached
|
# If not cached
|
||||||
if not uid in self.cache:
|
if not uid in self.cache:
|
||||||
|
@ -101,7 +101,7 @@ class Listener(StreamingClient):
|
||||||
def on_tweet(self, tweet: Tweet):
|
def on_tweet(self, tweet: Tweet):
|
||||||
# Check if the tweet is not a retweet
|
# Check if the tweet is not a retweet
|
||||||
if not tweet.text.startswith("RT @"):
|
if not tweet.text.startswith("RT @"):
|
||||||
username = self.get_user(tweet.author_id)
|
username = self._get_user(tweet.author_id)
|
||||||
# Clean the tweet
|
# Clean the tweet
|
||||||
lastWord = cleanTweet(tweet.text)
|
lastWord = cleanTweet(tweet.text)
|
||||||
|
|
||||||
|
@ -349,6 +349,7 @@ def start():
|
||||||
stream.add_rules([StreamRule(rule) for rule in rules])
|
stream.add_rules([StreamRule(rule) for rule in rules])
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Apply the filter
|
||||||
stream.filter(threaded=True, tweet_fields="author_id")
|
stream.filter(threaded=True, tweet_fields="author_id")
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue