|
网页源代码如图
https://v.m.jd.com/landpage/orde ... e&customerName=******5&sharePageType=2
网址如上
我的代码是这样的。我想要的是运单号那个class怎么都抓不出来。求解
- from bs4 import BeautifulSoup
- import requests
- import lxml
- target = 'https://v.m.jd.com/landpage/orderShare.action?shareData=1hxLnqRo%2BySyxqy1JvkXJPNwO%2Bb785pe&customerName=******5&sharePageType=2'
- req = requests.get(target)
- req.encoding = 'utf-8'
- html = req.text
- bf = BeautifulSoup(html,'lxml')
- titles = bf.find_all({'class': 'info-card mb-24 bl-br br-br'})
- for item in titles:
- title = item.text.strip()
- print(title)
复制代码
|
|