Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6133ec6

Browse files
committed
Process <img> and <frame> tags. Don't bother skipping second href.
1 parent de99d31 commit 6133ec6

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

Tools/webchecker/webchecker.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,11 +564,21 @@ def __init__(self):
564564
sgmllib.SGMLParser.__init__ (self)
565565

566566
def start_a(self, attributes):
567+
self.link_attr(attributes, 'href')
568+
569+
def end_a(self): pass
570+
571+
def do_img(self, attributes):
572+
self.link_attr(attributes, 'src', 'lowsrc')
573+
574+
def do_frame(self, attributes):
575+
self.link_attr(attributes, 'src')
576+
577+
def link_attr(self, attributes, *args):
567578
for name, value in attributes:
568-
if name == 'href':
579+
if name in args:
569580
if value: value = string.strip(value)
570581
if value: self.links[value] = None
571-
return # match only first href
572582

573583
def do_base(self, attributes):
574584
for name, value in attributes:
@@ -578,7 +588,6 @@ def do_base(self, attributes):
578588
if verbose > 1:
579589
print " Base", value
580590
self.base = value
581-
return # match only first href
582591

583592
def getlinks(self):
584593
return self.links.keys()

0 commit comments

Comments
 (0)