Skip to content

Instantly share code, notes, and snippets.

@kexibit1
Created May 28, 2018 01:54
Show Gist options
  • Save kexibit1/3c9f84ec9b664a5a95570421873dd43e to your computer and use it in GitHub Desktop.
Save kexibit1/3c9f84ec9b664a5a95570421873dd43e to your computer and use it in GitHub Desktop.

from bs4 import BeautifulSoup import requests

def get_html(url): r = requests.get(url) return r.text

def get_data_html(html): soup = BeautifulSoup(html, ‘lxml’) events = soup.find(‘div’, class_=’medium-widget event-widget last’).find_all(‘li’) for event in events: print(event.find(‘a’).text, end = ’ ‘) print(‘состоится’, end = ’ ‘) date = event.find(‘time’) print(date.text)

def main(): url = ‘https://www.python.org’ get_data_html(get_html(url))

if __name__ == ‘__main__’: main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment