mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Don't load unallowed tweets
This commit is contained in:
parent
42aea45a41
commit
d2cffe65d8
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from twitter import compose
|
||||
from twitter import compose, utils
|
||||
from twython import TwythonStreamer
|
||||
from pubsub import pub
|
||||
import logging as original_logger
|
||||
@ -26,7 +26,7 @@ class timelinesStreamer(TwythonStreamer):
|
||||
|
||||
def on_success(self, data):
|
||||
# try:
|
||||
if "text" in data:
|
||||
if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
|
||||
self.check_tls(data)
|
||||
# except:
|
||||
# pass
|
||||
|
@ -94,7 +94,7 @@ class streamer(TwythonStreamer):
|
||||
self.process_dm(data)
|
||||
elif "friends" in data:
|
||||
self.friends = data["friends"]
|
||||
elif "text" in data:
|
||||
elif "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
|
||||
if data["user"]["id"] in self.muted_users: return
|
||||
self.check_mentions(data)
|
||||
self.check_send(data)
|
||||
|
@ -99,6 +99,7 @@ def api_call(parent=None, call_name=None, preexec_message="", success="", succes
|
||||
return val
|
||||
|
||||
def is_allowed(tweet, clients):
|
||||
if tweet.has_key("sender"): return True
|
||||
allowed = True
|
||||
if tweet.has_key("retweeted_status"): tweet = tweet["retweeted_status"]
|
||||
source = re.sub(r"(?s)<.*?>", "", tweet["source"])
|
||||
|
Loading…
Reference in New Issue
Block a user