jkEpNotifier/main.py

49 lines
1.1 KiB
Python
Raw Permalink Normal View History

2022-02-17 20:59:18 +00:00
#!/bin/env python3
2021-12-20 06:51:26 +00:00
from bs4 import BeautifulSoup
import notify2
import requests
import time
2022-02-17 20:59:18 +00:00
import os
import sys
2021-12-20 06:51:26 +00:00
link = 'https://jkanime.net/'
anime = ''
notify2.init('A-notifier')
2022-02-17 20:59:18 +00:00
icon = os.path.join(sys.path[0])
icon = icon +'/icon/sup.ico'
2021-12-20 06:51:26 +00:00
def isItUp(anime):
on = 0
webp = requests.get('https://jkanime.net/')
soup = BeautifulSoup(webp.text, 'html.parser')
2022-02-17 20:59:18 +00:00
ani_list = []
date = []
pos = -1
2021-12-20 06:51:26 +00:00
recent_ani = soup.find_all('div', class_ = 'anime__sidebar__comment__item__text')
for div in recent_ani:
2022-02-17 20:59:18 +00:00
ani_list.append(div.h5.text)
date.append(div.span.text)
for x in ani_list:
if x == anime:
pos = ani_list.index(x)
if pos >= 0:
if date[pos] == """ Hoy
""":
2021-12-20 06:51:26 +00:00
on = 1
return on
while True:
online = isItUp(anime)
if online == 1:
n = notify2.Notification("Hiii" ,
2022-02-17 20:59:18 +00:00
anime + " is up! :3",
icon
2021-12-20 06:51:26 +00:00
)
n.show()
break
else:
2022-02-17 20:59:18 +00:00
print('not yet :c')
2021-12-20 06:51:26 +00:00
time.sleep(300)
2022-02-17 20:59:18 +00:00