mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Filtering by word should work as expected #102
This commit is contained in:
parent
e303d914fe
commit
9fd7c14e32
@ -140,15 +140,19 @@ def is_allowed(tweet, settings, buffer_name):
|
|||||||
return filter_tweet(tweet, settings, buffer_name)
|
return filter_tweet(tweet, settings, buffer_name)
|
||||||
|
|
||||||
def filter_tweet(tweet, settings, buffer_name):
|
def filter_tweet(tweet, settings, buffer_name):
|
||||||
|
if tweet.has_key("full_text"):
|
||||||
|
value = "full_text"
|
||||||
|
else:
|
||||||
|
value = "text"
|
||||||
for i in settings["filters"]:
|
for i in settings["filters"]:
|
||||||
if settings["filters"][i]["in_buffer"] == buffer_name:
|
if settings["filters"][i]["in_buffer"] == buffer_name:
|
||||||
regexp = settings["filters"][i]["regexp"]
|
regexp = settings["filters"][i]["regexp"]
|
||||||
word = settings["filters"][i]["word"]
|
word = settings["filters"][i]["word"]
|
||||||
if word != "" and settings["filters"][i]["if_word_exists"]:
|
if word != "" and settings["filters"][i]["if_word_exists"]:
|
||||||
if word not in tweet["full_text"]:
|
if word not in tweet[value]:
|
||||||
return False
|
return False
|
||||||
elif word != "" and settings["filters"][i]["if_word_exists"] == False:
|
elif word != "" and settings["filters"][i]["if_word_exists"] == False:
|
||||||
if word in tweet["full_text"]:
|
if word in tweet[value]:
|
||||||
return False
|
return False
|
||||||
if settings["filters"][i]["in_lang"] == "True":
|
if settings["filters"][i]["in_lang"] == "True":
|
||||||
if tweet["lang"] not in settings["filters"][i]["languages"]:
|
if tweet["lang"] not in settings["filters"][i]["languages"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user