def fix_parsel_parser(new_type='html_html', base_type='html'):
"""Fix a custom parser for parsel using lxml.html.HTMLParser.
The main reason is to have handy helpers as make_links_absolute method.
"""
selector._ctgroup[new_type] = selector._ctgroup[base_type].copy()
selector._ctgroup[new_type]['_parser'] = lxml_html.HTMLParser
return new_type
评论列表
文章目录