python羊 发表于 2020-9-15 23:40:49

请问该网页怎么提取相应的数据

本帖最后由 python羊 于 2020-9-16 09:31 编辑

想要提取网页中 “净度”对应的 “VS1”,可是一直找到的是空值。

网站:https://www.gia.edu/report-check?reportno=6352100549
代码:
————————————————————
from urllib.request import Request,urlopen
import re
number = '6352100549'
url = 'https://www.gia.edu/report-check?reportno='+ number
headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1500.55 Safari/537.36'
}

request = Request(url,headers=headers)
response = urlopen(request).read()
response = response.decode('utf-8')

clarity = re.findall('<strong class="dynamic" id="CLARITY_GRADE">(.+)</strong>',response)

print(response)
print(clarity)

——————————————————————————————————————————

疾风怪盗 发表于 2020-9-16 09:28:45

https://fishc.com.cn/forum.php?mod=viewthread&tid=180246&extra=page%3D1%26filter%3Dtypeid%26typeid%3D392
你这是开了两个相同的帖子?
页: [1]
查看完整版本: 请问该网页怎么提取相应的数据