1. 程式人生 > >html 文本解碼 xpath 獲取html標簽

html 文本解碼 xpath 獲取html標簽

sca () html nes cap pre ide pat imp

import html
import etree
url_h2 = selector.xpath("//a[@_stat=‘video:poster_v‘]/../h2")[0]
url_div = selector.xpath("//a[@_stat=‘video:poster_v‘]/../div")[0]
url_h2 = etree.tostring(url_h2).decode()
url_div = etree.tostring(url_div).decode()
print("******", url, url_img, html.unescape(url_h2), html.unescape(url_div))

html 文本解碼 xpath 獲取html標簽