LinkFinder does not raise StopParse

This commit is contained in:
Chris Mayo 2020-04-10 16:19:33 +01:00
parent ee6628a831
commit d189445a8e
2 changed files with 3 additions and 15 deletions

View file

@ -116,14 +116,8 @@ def find_links (url_data, callback, tags):
"""Parse into content and search for URLs to check.
Found URLs are added to the URL queue.
"""
# construct handler object
handler = linkparse.LinkFinder(callback, tags)
# parse
try:
htmlsoup.process_soup(handler, url_data.get_soup())
except linkparse.StopParse as msg:
log.debug(LOG_CHECK, "Stopped parsing: %s", msg)
pass
htmlsoup.process_soup(handler, url_data.get_soup())
def parse_firefox (url_data):

View file

@ -30,10 +30,7 @@ class TestLinkparser (unittest.TestCase):
def _test_one_link (self, content, url):
self.count_url = 0
h = linkparse.LinkFinder(self._test_one_url(url), linkparse.LinkTags)
try:
htmlsoup.process_soup(h, htmlsoup.make_soup(content))
except linkparse.StopParse:
pass
htmlsoup.process_soup(h, htmlsoup.make_soup(content))
self.assertEqual(self.count_url, 1)
def _test_one_url (self, origurl):
@ -47,10 +44,7 @@ class TestLinkparser (unittest.TestCase):
def callback (url, line, column, name, base):
self.assertTrue(False, 'URL %r found' % url)
h = linkparse.LinkFinder(callback, linkparse.LinkTags)
try:
htmlsoup.process_soup(h, htmlsoup.make_soup(content))
except linkparse.StopParse:
pass
htmlsoup.process_soup(h, htmlsoup.make_soup(content))
def test_href_parsing (self):
# Test <a href> parsing.