import requests
from lxml import html
import time
from datetime import datetime
from tkinter import messagebox
from playsound import playsound
'''
Ya esta publicado en la pagina, pero no tiene ningun hipervinculo, sonara la alarma cuando se agrege alguno.
'''
while True:
res = requests.get("https://www.deportick.com/")
source_code = html.fromstring(res.content)
eventoArgentina = source_code.xpath('/html/body/div[4]/div/div[2]/div/div/div/div[1]/div/a')[0]
link = eventoArgentina.get('href')
if link:
print("\nHora: {}\nSe publicaron las entradas!\n".format(datetime.fromtimestamp(time.time())))
playsound('chiquitapia.mp3')
messagebox.showinfo(message="La imagen tiene un link asociado!", title="ATENCION")
print(link)
break
else:
print("\nHora: {}\nSiguen sin publicarse las entradas :C\n".format(datetime.fromtimestamp(time.time())))
time.sleep(60)