求问aspx的网页数据怎么爬啊 这种的数据并没有存在源代码里 xpath提取不到啊
比如http://stockdata.stock.hexun.com/zrbg/Plate.aspx?date=2018-12-31import requests
import urllib as ulb
from lxml import etree
url = ('http://stockdata.stock.hexun.com/zrbg/Plate.aspx?date={}-12-31'.format(2018))
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36'}
req = ulb.request.Request(url=url, headers=headers)
response = ulb.request.urlopen(req)
html1 = response.read().decode('gb2312') #网页源代码
html=etree.HTML(html1)#网页源代码elements格式
stock_name=html.xpath('//div[@id="gkcTable"]/table/tbody/tr[2]/td[2]/a/text()')
print(stock_name)
这个运行后结果是[]
啥也提取不到 |