File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from bs4 import BeautifulSoup as bs
33import requests
44
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"
66# US english
77LANGUAGE = "en-US,en;q=0.5"
88
@@ -35,7 +35,7 @@ def get_weather_data(url):
3535 days = soup .find ("div" , attrs = {"id" : "wob_dp" })
3636 for day in days .findAll ("div" , attrs = {"class" : "wob_df" }):
3737 # 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' ]
3939 # get weather status for that day
4040 weather = day .find ("img" ).attrs ["alt" ]
4141 temp = day .findAll ("span" , {"class" : "wob_t" })
You can’t perform that action at this time.
0 commit comments