SHARE
TWEET

weweeeeeeeeeeeeeeeeeeeeeeeeee

a guest Jul 17th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4.  
  5. months = ['january', 'february', 'march', 'april','may', 'june', 'july', 'august', 'september', 'october', 'november',
  6.           'december']
  7.  
  8.  
  9.  
  10. def get_html(url):
  11.     respon = requests.get(url)
  12.     return respon.text
  13.  
  14. def parse_weather_month(html):
  15.     soup = BeautifulSoup(html, 'lxml')
  16.     table = soup.find('div', class_='climate-calendar').find_all('div','climate-calendar__row')
  17.     weather_g = {}
  18.     for j in table:
  19.         if ('climate-calendar__row_header') not in j['class']:
  20.             for z in j:
  21.                 if 'climate-calendar-day_colorless_yes' not in z.find('div')['class']:
  22.                     weather = z.find('div', 'temp climate-calendar-day__temp-day').text.strip()
  23.                     day = z.find('div', class_='climate-calendar-day__day').text
  24.                     print(day)
  25.  
  26.  
  27. for q in range(12):
  28.     url = 'https://yandex.ru/pogoda/novosibirsk/month/' + months[q]
  29.     html = get_html(url)
  30.     parse_weather_month(html)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top