geekcomputers / Python

My Python Examples
http://www.thegeekblog.co.uk
MIT License
31.22k stars 12.2k forks source link

Url change in weather scrapper #494

Open Gliterament opened 5 years ago

Gliterament commented 5 years ago

The url of query of city has already changed, and there's national code between city name and 'https://www.wunderground.com/weather/' for example: the 'https://www.wunderground.com/weather/in/taizhou' doesn't work while 'https://www.wunderground.com/weather/cn/taizhou' works

Amyth07 commented 5 years ago

can I take this one?

harisijazwarraich commented 5 years ago

The url of query of city has already changed, and there's national code between city name and 'https://www.wunderground.com/weather/' for example: the 'https://www.wunderground.com/weather/in/taizhou' doesn't work while 'https://www.wunderground.com/weather/cn/taizhou' works

"country_code = input('Enter Country Code:') city = input('Enter City:') url = (f'https://www.wunderground.com/weather/{country_code}/{city}')"

you can have this code. here 'in' in the url acts as a country code, so there is no city named taizhou in India.