首页 > 解决方案 > __scraping__ 网站时找不到服务器端值

问题描述

您好,我想抓取一个天气网站https://www.theweathernetwork.com/。我编写下面的代码来获取实时天气,但在我的代码中没有得到任何价值。

输入

from bs4 import BeautifulSoup
import requests


html_page = requests.get("https://www.theweathernetwork.com/bd/weather/dhaka/dhaka")
soup = BeautifulSoup(html_page.content, 'lxml')

content=soup.find(class_='wx-content current-obs')

temp=content.find('span', class_='temp')

temp

输出

[<span>°</span>]

标签: pythonpython-3.xpython-2.7web-scraping

解决方案


推荐阅读