24 lines
494 B
Python
Executable File
24 lines
494 B
Python
Executable File
#!/bin/python2.7
|
|
from HTMLParser import HTMLParser
|
|
import httplib
|
|
|
|
starttag = ""
|
|
|
|
class MyHTMLParser(HTMLParser):
|
|
def handle_starttag(self, tag, attrs):
|
|
global starttag
|
|
starttag = tag
|
|
#print starttag
|
|
def handle_data(self, data):
|
|
#print starttag
|
|
if starttag == "code":
|
|
print data
|
|
pass
|
|
|
|
|
|
conn = httplib.HTTPSConnection("www.python.org")
|
|
conn.request("GET", "/")
|
|
r1 = conn.getresponse()
|
|
parser = MyHTMLParser()
|
|
|
|
parser.feed(r1.read()) |