Closed mikeckennedy closed 4 years ago
Closing this because we are updating the video. You can still comment on it.
I am having problems at this part of the program. Any chance you could help? Thanks
Actually, this still isn't quite correct.
When asking for city, you include placeholder for state, but don't include any format
. It should read
state = input('What US state do you want the weather for (e.g. OR)? ')
city = input('What city in [{}] (e.g. Portland)? '.format(state))
This would make the url
in get_html_from_web(state, city):
url = 'https://www.wunderground.com/weather/us/{}/{}'.format(state.lower(), city.lower())
Hi, yes, this looks like a nice little user-friendly addition @chronoviking Thanks.
As of Jan 2020, Wunderground changed their site so the video as recorded, doesn't work. Here's what you need to change.
First, see that the URL has changed from zipcode to state/city, for example:
https://www.wunderground.com/weather/us/or/portland
That means you'll need to ask for state and city rather than zipcode from the user and pass that to
get_html_from_web
. This should work now:Additionally, the CSS selectors have changed to the following:
Finally, cleanup of the city H1 text needs to change just a little:
Sorry for the trouble, but we can't force them to not change the site.