1
+ import requests
2
+ import bs4
3
+ from tkinter import *
4
+ from tkinter import messagebox
5
+
6
+ #fetching the data from url
7
+ def nextdate (name ):
8
+ try :
9
+ res = requests .get ("https://www.episodate.com/tv-show/" + name )
10
+ soup = bs4 .BeautifulSoup (res .text , 'html.parser' )
11
+ next_air_date = soup .find ('div' , {'class' : 'countdown' })
12
+ next_episode = str (next_air_date )[34 :63 ]
13
+ next_episode = next_episode .replace ('"' , "" )
14
+ next_episode = next_episode .replace ("status" , "" )
15
+ next_episode = next_episode .replace ("/div><" , "" )
16
+ next_episode = next_episode .replace ("class=><a href=/sear" ,
17
+ "Show not Found" )
18
+ if (next_episode == None ):
19
+ check = soup .find ('div' , {
20
+ 'class' : 'countdown'
21
+ }).find ('div' , {"class" : "status" })
22
+ check_status = check .getText ()
23
+ return check_status
24
+ else :
25
+ return next_episode
26
+ except :
27
+ return "Show Not Found"
28
+
29
+ ## function for confirming the data
30
+ def function ():
31
+ value = nextdate (e .get ().lower ())
32
+ mylabel = Label (frame , text = e .get () + " " + value )
33
+ mylabel .pack ()
34
+ messagebox .showinfo ("Next airing date: " + e .get (), value )
35
+
36
+ #defining the main output grid
37
+ value = ""
38
+ root = Tk ()
39
+ root .title ("Next Episode date" )
40
+ frame = LabelFrame (root ,
41
+ text = "Find your TV Show/anime next Episode Date:" ,
42
+ padx = 5 ,
43
+ pady = 5 )
44
+ frame .pack (padx = 10 , pady = 10 )
45
+ e = Entry (frame , width = 25 )
46
+ e .pack ()
47
+ b = Button (frame , text = "search" , command = function )
48
+ b .pack ()
49
+ root .mainloop ()
0 commit comments