2022-05-29 10:29:31 +00:00
|
|
|
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]"
|
|
|
|
|
2022-07-27 16:18:18 +00:00
|
|
|
class Web_KerkOmroep(Web_StreamService):
|
2022-05-29 10:29:31 +00:00
|
|
|
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()
|
2022-07-27 16:18:18 +00:00
|
|
|
|
|
|
|
def pre_load_actions(self, driver):
|
|
|
|
pass
|
2022-05-29 10:29:31 +00:00
|
|
|
|
|
|
|
def post_load_actions(self, driver):
|
|
|
|
self.click_video_play(driver)
|