Church_AutoStream/streaming/kerkomroep.py

41 lines
1.2 KiB
Python
Raw Normal View History

import urllib.request
from streaming.base_stream import *
IMMANUELKAPEL_URL = "https://kerkdienstgemist.nl/stations/2112-Immanuelkapel/"
ICHTHUSKERK_URL = "https://kerkdienstgemist.nl/stations/2110-Ichthuskerk-Ridderkerk/"
LIVESTREAM_URL = "events/live"
XPATH= "/html/body/div[5]/div/article/div/div/div[1]/div[1]/div/div[2]"
class Web_KerkOmroep(Web_StreamService):
def __init__(self, kerk_id=IMMANUELKAPEL_URL) -> None:
self.kerk_id = kerk_id #URL that points to the church inside the kerkomroep environment
pass
def livestream_url(self):
return f"https://kerkdienstgemist.nl/stations/{self.kerk_id}/{LIVESTREAM_URL}"
def is_live(self):
# TODO add check to see when the livestream goes up
return True
def get_xpath(self):
return XPATH
def click_video_play(self, driver):
while True:
try:
button = driver.find_element(by=By.XPATH, value=self.get_xpath())
if button != None:
break
except:
pass
time.sleep(1)
button.click()
def pre_load_actions(self, driver):
pass
def post_load_actions(self, driver):
self.click_video_play(driver)