twitter: Add support for phrase.
Twitter supports phrase search by quoting terms such as "Zulip API". If we use the feature, the current twitter-bot can't detect used search phrase. We can detect used search phrase with this change.
This commit is contained in:
parent
957b5e7ad8
commit
843b21769a
|
@ -243,6 +243,10 @@ for status in statuses[::-1][:opts.limit_tweets]:
|
||||||
if opts.search_terms:
|
if opts.search_terms:
|
||||||
search_term_used = None
|
search_term_used = None
|
||||||
for term in opts.search_terms.split(","):
|
for term in opts.search_terms.split(","):
|
||||||
|
# Remove quotes from phrase:
|
||||||
|
# "Zulip API" -> Zulip API
|
||||||
|
if term.startswith('"') and term.endswith('"'):
|
||||||
|
term = term[1:-1]
|
||||||
if any(term.lower() in text for text in text_to_check):
|
if any(term.lower() in text for text in text_to_check):
|
||||||
search_term_used = term
|
search_term_used = term
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue