title: How can I use the python HTMLParser library to extract data from a specific div tag?
body: <p>I am trying to get a value out of a HTML page using the python HTMLParser library. The value I want to get hold of is within this HTML element:</p>
  <pre><code>...
  &lt;div id=&quot;remository&quot;&gt;20&lt;/div&gt;
  ...
  </code></pre>
  <p>This is my HTMLParser class so far:</p>
  <pre><code>class LinksParser(HTMLParser.HTMLParser):
    def __init__(self):
      HTMLParser.HTMLParser.__init__(self)
      self.seen = {}
  
    def handle_starttag(self, tag, attributes):
      if tag != 'div': return
      for name, value in attributes:
      if name == 'id' and value == 'remository':
        #print value
        return
  
    def handle_data(self, data):
      print data
  
  p = LinksParser()
  f = urllib.urlopen(&quot;http://example.com/somepage.html&quot;)
  html = f.read()
  p.feed(html)
  p.close()
  </code></pre>
  <p>I want the class functionality to get the value 20.</p>