def get_content(source):
'''
get the content from the source code page
:param source:
:return:
'''
selector = html.document_fromstring(source)
content = selector.xpath('//div[@class="readtext"]')[0]
num = content.xpath('h4/text()')
every_content = content.xpath('p/text()')
write_file(num)
for each in every_content:
write_file(each)
评论列表
文章目录