FIX: Stopped the parser from printing all data from the starttag, turns out o forgot to reset the variable when it encounters the endtag... *facepalm
This commit is contained in:
parent
cb706839bc
commit
f230a5bb80
11
HTTPy.py
11
HTTPy.py
@ -12,17 +12,24 @@ class MyHTMLParser(HTMLParser):
|
|||||||
global conf_temp
|
global conf_temp
|
||||||
global starttag
|
global starttag
|
||||||
if tag == conf_temp:
|
if tag == conf_temp:
|
||||||
|
# starttag = tag
|
||||||
for name, value in attrs:
|
for name, value in attrs:
|
||||||
if name == "class" and value == "df-raw":
|
if name == "class" and value == "df-raw":
|
||||||
print tag
|
print tag
|
||||||
starttag = tag
|
starttag = tag
|
||||||
pass
|
# pass
|
||||||
#print starttag
|
#print starttag
|
||||||
|
|
||||||
|
def handle_endtag(self, tag):
|
||||||
|
global starttag
|
||||||
|
if tag == "pre":
|
||||||
|
starttag = ""
|
||||||
|
|
||||||
def handle_data(self, data):
|
def handle_data(self, data):
|
||||||
#print starttag
|
#print starttag
|
||||||
if starttag == conf_temp:
|
if starttag == conf_temp:
|
||||||
print data
|
print data
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
conn = httplib.HTTPSConnection("www.whois.com")
|
conn = httplib.HTTPSConnection("www.whois.com")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user