42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
import datetime
|
|
import webbrowser
|
|
import holidays
|
|
from selenium import webdriver
|
|
import time
|
|
from selenium.webdriver import ActionChains
|
|
|
|
day = datetime.datetime.now().weekday()
|
|
#refomroep_url = "https://reformatorischeomroep.nl"
|
|
refomroep_url = "https://reformatorischeomroep.nl/zenders/radio-1"
|
|
refomroep_stream = "https://ssl.streampartner.nl/player.php?url=refo37ab25da27fdcfb&w=auto&h=40px"
|
|
spijkenissee_omroep_url = "https://www.dearkspijkenisse.nl/kerkdiensten"
|
|
feestdagen = holidays.NL()
|
|
sunday = False
|
|
|
|
#Get day of week and feestday.
|
|
if(day == 6):
|
|
print("Its a sunday!")
|
|
sunday = True
|
|
else:
|
|
if(day in feestdagen):
|
|
print("Its a dutch holliday!")
|
|
sunday = True
|
|
else:
|
|
print("Its a weekday")
|
|
|
|
if(sunday):
|
|
driver = webdriver.Firefox(executable_path="./geckodriver")
|
|
driver.get(spijkenissee_omroep_url)
|
|
time.sleep(7)
|
|
button = driver.find_element_by_xpath('//html//body//div[1]//div//div[1]//div[3]//div[2]//iframe[1]')
|
|
print(button.location)
|
|
actionChains = ActionChains(driver)
|
|
actionChains.move_to_element(button).click().perform()
|
|
else:
|
|
driver = webdriver.Firefox(executable_path="./geckodriver")
|
|
driver.get(refomroep_url)
|
|
time.sleep(7)
|
|
button = driver.find_element_by_xpath('//html//body//div//main//section//div[1]//div//iframe')
|
|
print(button.location)
|
|
actionChains = ActionChains(driver)
|
|
actionChains.move_to_element(button).click().perform() |