我正在尝试使用beautiful来提取脚本的json部分汤,但是什么也没印出来。怎么了?
导入请求,json
从bs4导入BeautifulSoup
标头= {
'用户代理':'Mozilla / 5.0(Macintosh; Intel Mac OS X 10_11_6)AppleWebKit / 537.36(KHTML,例如Gecko)Chrome / 56.0.2924.87 Safari / 537.36',
'referrer':'https://google.com',
'接受':'text / html,application / xhtml + xml,application / xml; q = 0.9,image / webp,image / apng,* / *; q = 0.8',
'Accept-Encoding':'gzip,deflate,br',
'接受语言':'en-US,en; q = 0.9',
'Pragma':'no-cache',
}
r = request.get('https://www.joox.com/id/id/single/xtMtD9ZdeLEdHp1w1fip8w==',headers=headers)
汤= BeautifulSoup(r.content,'html5lib')
数据= json.loads(soup.find('script')。text)
打印(数据)
汤的结果是: