34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
|
from streaming.base_stream import *
|
||
|
|
||
|
ICHTHUSKERK_ID = "UCIh6v7QDfo8FBYAifTMrD3A"
|
||
|
IMMANUELKAPEL_ID = "UCud4rRtOf2e146HZWDfj6YA"
|
||
|
START_FULL_WINDOW = "?start=68" #Note, this is not full screen, but full window
|
||
|
|
||
|
class Youtube(StreamService):
|
||
|
def __init__(self, id=IMMANUELKAPEL_ID) -> None:
|
||
|
self.id = id
|
||
|
|
||
|
def livestream_url(self):
|
||
|
return f"https://www.youtube.com/channel/{self.id}/live{START_FULL_WINDOW}"
|
||
|
|
||
|
def is_live(self):
|
||
|
return True
|
||
|
|
||
|
def post_load_actions(self):
|
||
|
return
|
||
|
|
||
|
def post_load_actions(self, driver):
|
||
|
self.bypass_cookies(driver)
|
||
|
|
||
|
def bypass_cookies(self, driver):
|
||
|
if 'consent.youtube.com' in driver.current_url:
|
||
|
while True:
|
||
|
try:
|
||
|
accept_button = driver.find_elements(by=By.XPATH, value='//*[contains(text(),"Accept all")]')[1]
|
||
|
if accept_button != None:
|
||
|
break
|
||
|
except:
|
||
|
pass
|
||
|
time.sleep(1)
|
||
|
accept_button.click()
|
||
|
#driver.find_element_by_xpath('//button[@aria-label="Agree to the use of cookies and other data for the purposes described"]').click()
|