Files
beer-price/beer.py
2021-04-28 20:38:23 +03:00

21 lines
487 B
Python
Executable File

#!/usr/bin/python3
# coding=UTF-8
import sys
sys.path.append('/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages')
import requests
from bs4 import BeautifulSoup
url = "https://spb.bar"
req = requests.get(url)
soup = BeautifulSoup(req.content, 'html.parser')
rows = soup("tr")
prices = [int(row("td")[-1].text[:-2]) for row in rows]
mean = sum(prices)/len(prices)
print("🍺 · " + str(round(mean)) + "")
print("🍺 ⥶ " + str(min(prices)) + "")