|
2 | 2 | frombs4importBeautifulSoupasbs
|
3 | 3 | importrequests
|
4 | 4 |
|
5 |
| -USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" |
| 5 | +USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36" |
6 | 6 | # US english
|
7 | 7 | LANGUAGE="en-US,en;q=0.5"
|
8 | 8 |
|
@@ -35,7 +35,7 @@ def get_weather_data(url):
|
35 | 35 | days=soup.find("div",attrs={"id":"wob_dp"})
|
36 | 36 | fordayindays.findAll("div",attrs={"class":"wob_df"}):
|
37 | 37 | # extract the name of the day
|
38 |
| -day_name=day.find("div",attrs={"class":"vk_lgy"}).attrs['aria-label'] |
| 38 | +day_name=day.findAll("div")[0].attrs['aria-label'] |
39 | 39 | # get weather status for that day
|
40 | 40 | weather=day.find("img").attrs["alt"]
|
41 | 41 | temp=day.findAll("span", {"class":"wob_t"})
|
|