title: Twitter REST API: tweet extraction
body: <p>The following code has been written by me to extract tweets with specific hashtags. </p>
  
  <pre><code>import json
  import oauth2
  import time
  import io
  
  
  Consumer_Key = ""
  Consumer_Secret = ""
  
  access_token = ""
  access_token_secret = ""
  
  
  def oauth_req(url, key, secret, http_method="GET", post_body="", http_headers=None):
          consumer = oauth2.Consumer(key="", secret="")
          token = oauth2.Token(key=key, secret=secret)
          client = oauth2.Client(consumer, token)
          content = client.request( url, method=http_method, body=post_body, headers=http_headers )
          return content
  
  tweet_url = 'https://twitter.com/search.json?q=%23IPv4%20OR%20%23ISP%20OR%20%23WiFi%20OR%20%23Modem%20OR%20%23Internet%20OR%20%23IPV6'   
  jsn = oauth_req( tweet_url, access_token, access_token_secret )
  print jsn
  </code></pre>
  
  <p>My hashtags are: IPv4, IPv6, ISP, Internet, Modem. I want my code to see if a tweet has at least one of the hashtags that tweet should be written to my file.
  But, unfortunately it is returning the html tags instead.
  The output is as follows:</p>
  
  <pre><code>({'content-length': '338352', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff',........................
  .............................-post-iframe" name="tweet-post-iframe"&gt;&lt;/iframe&gt;\n  &lt;iframe aria-hidden="true" class="dm-post-iframe" name="dm-post-iframe"&gt;&lt;/iframe&gt;\n\n&lt;/div&gt;\n\n  &lt;/body&gt;\n&lt;/html&gt;\n')
  </code></pre>
  
  <p>Any lead in this regard will be appreciated.</p>