我正试着用美丽的阳光从当地的湖中刮去湖水的温度。你知道吗
结果源代码(通过在Chorme浏览器中显示源代码)或使用beautifulsoup刮取的内容为空。你知道吗
html source code out of the browser
url = 'https://www.goitzsche-tourismus.de/goitzsche-bitterfeld/specials/172-wassertemperatur/'
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
txt = soup.find("div", {"id": "pegel"}).get_text()
print('content:', txt, 'should be here')
结果:content: should be here
在Chrome开发工具控制台中,如果我键入$0
,我会得到正确的结果。你知道吗
use the developer tool console - result is correct
问:我如何得到温度值? 问:为什么我看不到“基本”源代码中的值?你知道吗
谢谢你的提示
我刚才回答了一些问题。你知道吗
基本上,站点加载在站点的基本代码中,并通过加载在温度值中。Javascript。他们的代码调用另一个包含这些数据的API。你知道吗
您也可以模拟并可能利用它(从道德上讲,您应该获得自己的API密钥),并解析JSON result。你知道吗
我收到的回复是:
相关问题 更多 >
编程相关推荐