from requests_html import HTMLSession session = HTMLSession() headers = { "User-Agent":"scrapy" } resp = session.get('http://www.spbeen.com/tool/request_info/',headers = headers) ua = resp.html.xpath('.//div[@class="ui red segment"]/div[last()]') print(ua[0].text) #获取网站的ua