How can I change the search to return results for "hate art" in python (I've included the code)


#1

All I want to do is to detect whenever a tweet has been posted with the words “hate art” from any twitter user. How would I do this with my code?

#twitter url
turl = "http://api.twitter.com/1.1/search/tweets.json?q="

#My app keys and secrets
CONSUMER_KEY = "T***Rg"
CONSUMER_SECRET = "jRVxtE***N8L4a3s"
OAUTH_TOKEN = "528854993-7***hna2K36g4y79oiwUq"
OAUTH_SECRET = "ZoQECSe3VEV6DD***v1deAQ"

#My twitter object that will be used to interact with the api
t = Twitter(
  auth=OAuth(OAUTH_TOKEN,OAUTH_SECRET,CONSUMER_KEY,CONSUMER_SECRET)
)

#Setup the GPIO pins
GPIO.cleanup()
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)

#Until Ctrl-C is pressed continue to do this
try:
  while True:
 
    #Get the latest status tweet
    twitter_results = t.statuses.home_timeline()
    tweet = twitter_results[0]['art']
 
    #Turn on the LED if LED-ON is contained within the text
    if "LED-ON" in tweet:
      print "LED turned ON"
      GPIO.output(7,GPIO.HIGH)
 
    #Turn off the LED if LED-OFF is contained within the text
    if "LED-OFF" in tweet:
      print "LED turned OFF"
      GPIO.output(7,GPIO.LOW)
 
    #Sleep for 2 seconds before trying again
    time.sleep(60)
 
except KeyboardInterrupt:
  print "Exiting now"
  GPIO.cleanup()