Merge pull request #313 from cjmayo/titlefinder

Remove unused linkparse.TitleFinder
This commit is contained in:
anarcat 2019-10-07 11:30:10 -04:00 committed by GitHub
commit 7cfb1136e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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."""