17.splash_case01

# 抓取今日头条,对比渲染和没有渲染的效果

import requests
from lxml import etree

# url = 'http://localhost:8050/render.html?url=https://www.toutiao.com&timeout=30&wait=0.5'
url = 'https://www.toutiao.com'

response = requests.get(url)

print(response.text)

tree = etree.HTML(response.text)

article_titles = tree.xpath('//div[@class="title-box"]/a/text()')

print(article_titles)
上一篇:MySql索引背后的数据结构及算法


下一篇:react 踩坑--this.props.form.getFieldValue()获取不到输入的值