forked from geekcomputers/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cricket_score.py
37 lines (24 loc) · 844 Bytes
/
Cricket_score.py
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
36
37
from urllib import request
import os
import pyttsx3
import bs4 # Beautiful Soup for Web Scraping
from win10toast import ToastNotifier
toaster = ToastNotifier()
#url from where we extrat data
url = "http://www.cricbuzz.com/cricket-match/live-scores"
sauce = request.urlopen(url).read()
soup = bs4.BeautifulSoup(sauce, "lxml")
score = []
results = []
for div_tags in soup.find_all('div', attrs={"class": "cb-lv-scrs-col text-black"}):
score.append(div_tags.text)
for result in soup.find_all('div', attrs={"class": "cb-lv-scrs-col cb-text-complete"}):
results.append(result.text)
engine = pyttsx3.init()
# testing
engine.say("match score and result is")
print(score[0], results[0])
toaster.show_toast(title=score[0], msg=results[0])
engine.runAndWait()
# initialisation
#after my update now this program speaks