-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeb Text Reader.py
More file actions
35 lines (28 loc) · 834 Bytes
/
Web Text Reader.py
File metadata and controls
35 lines (28 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from tkinter import *
import requests as r
from bs4 import BeautifulSoup as bs
import pyttsx3 as sp
app = Tk()
app.title("WEBSITE TEXT READER")
wwidth = "300"
wheight = "300"
text = "Your Website Link Here !"
app.geometry(wwidth+"x"+wheight)
label = Label(text=text)
label.place(x=(int(wwidth)//2)-50,y=(int(wheight)//2)-50)
inpbox = Entry(width=50)
inpbox.place(x=(int(wwidth)//2)-110,y=(int(wheight)//2))
button = Button(text='Submit Your Website')
button.place(x=(int(wwidth)//2)-110,y=(int(wheight)//2)+50)
def fetch_and_speak(event):
url = r.get(inpbox.get())
data = url.text
soup = bs(data,'html.parser')
for nonsense in soup(['script','style']):
nonsense.extract()
text = soup.get_text()
initsp = sp.init()
initsp.say(text)
initsp.runAndWait()
app.bind("<Button-1>",fetch_and_speak)
app.mainloop()