Created
January 22, 2018 21:41
-
-
Save audy/6de59eb1874b486a0d4e66e099c1af92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
from bs4 import BeautifulSoup | |
url = 'http://www.berkeleybowl.com/daily-hot-soup' | |
res = requests.get(url) | |
soup = BeautifulSoup(res.content, 'html5lib') | |
locations = soup.find_all('div', class_='block-inner')[3:5] | |
for location in locations: | |
name = location.find(class_='block-title').text | |
print(name) | |
print('='*len(name)) | |
timestamp = location.find_all(class_='field-item')[0].text | |
print('* {} *\n'.format(timestamp)) | |
soups = [ n.text for n in location.find_all(class_='field-item')[1:] ] | |
for n, soup in enumerate(soups): | |
print('{}.) {}'.format(n, soup)) | |
print('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment