123456789101112131415161718 |
- from lxml import etree
- from .ProcessTool import html_unicode_2_chinese, process_str, remove_html_tags
- def get_like_count(html):
- selector = etree.HTML(html)
- wei_bo_like_count_temp = selector.xpath(
- '//div[@class="card-act"]/ul/li[3]/a/button/span[2]')
- wei_bo_like_count = []
- for i in wei_bo_like_count_temp:
- temp = remove_html_tags(etree.tostring(i))
- temp = html_unicode_2_chinese(temp)
- temp = process_str(temp)
- if temp == '赞':
- wei_bo_like_count.append('0')
- else:
- wei_bo_like_count.append(temp)
- return wei_bo_like_count
|