1
0
Fork 0
mirror of https://github.com/Findus23/RadioStats.git synced 2024-09-19 16:03:48 +02:00
RadioStats/parser/eng.py
Lukas Winkler 58787c65b2
add Energy
2018-02-25 14:58:30 +01:00

19 lines
787 B
Python

from bs4 import BeautifulSoup
from utils import *
def get(channel):
url = "http://www.energy.at/extern/tifo/?station=vie&hour={hour}&min={min}&date={date}&submit=1"
now = datetime.now() - timedelta(minutes=30)
url = url.format(hour=now.hour, min=now.minute, date=now.strftime("%d.%m.%Y"))
soup = BeautifulSoup(fetch(url, False), 'html.parser')
print(url)
for item in soup.findAll("div", "item"):
artist = item.find("p", "interpret").get_text()
title = item.find("p", "title").get_text()
timestring = item.find("span", "time").get_text()
datestring = item.find("span", "date").get_text()
time = local_to_utc(datetime.strptime(datestring + " " + timestring, '%d.%m.%Y %H:%M'))
yield time, artist, title
exit()