mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-19 12:01:07 +00:00
Merge pull request #313 from cjmayo/titlefinder
Remove unused linkparse.TitleFinder
This commit is contained in:
commit
7cfb1136e9
1 changed files with 0 additions and 21 deletions
|
|
@ -24,7 +24,6 @@ from . import linkname
|
|||
from builtins import str as str_text
|
||||
|
||||
MAX_NAMELEN = 256
|
||||
MAX_TITLELEN = 256
|
||||
|
||||
unquote = strformat.unquote
|
||||
|
||||
|
|
@ -101,26 +100,6 @@ class StopParse(Exception):
|
|||
pass
|
||||
|
||||
|
||||
class TitleFinder (object):
|
||||
"""Find title tags in HTML text."""
|
||||
|
||||
def __init__ (self):
|
||||
"""Initialize title."""
|
||||
super(TitleFinder, self).__init__()
|
||||
log.debug(LOG_CHECK, "HTML title parser")
|
||||
self.title = None
|
||||
|
||||
def start_element (self, tag, attrs):
|
||||
"""Search for <title> tag."""
|
||||
if tag == 'title':
|
||||
data = self.parser.peek(MAX_TITLELEN)
|
||||
data = data.decode(self.parser.encoding, "ignore")
|
||||
self.title = linkname.title_name(data)
|
||||
raise StopParse("found <title> tag")
|
||||
elif tag == 'body':
|
||||
raise StopParse("found <body> tag")
|
||||
|
||||
|
||||
class TagFinder (object):
|
||||
"""Base class handling HTML start elements.
|
||||
TagFinder instances are used as HtmlParser handlers."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue