Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cf1a6eb

Browse files
committed
code for scraping crickbuz live score
1 parent 022bf32 commit cf1a6eb

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎Live_Cricket_Score/live_score.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from urllib.request import urlopen,Request
2+
from bs4 import BeautifulSoup
3+
from win10toast import ToastNotifier
4+
import time
5+
6+
URL = 'http://www.cricbuzz.com/cricket-match/live-scores'
7+
8+
9+
def notify(title,score):
10+
# Function for Windows toast desktop notification
11+
toaster = ToastNotifier()
12+
# toaster.show_toast(score, "Get! Set! GO!", duration=5,icon_path='cricket.ico')
13+
toaster.show_toast("CRICKET LIVE SCORE",score, duration=30,icon_path='ipl.ico')
14+
15+
while True:
16+
request = Request(URL,headers={'User-Agent': 'XYZ/3.0'})
17+
response = urlopen(request,timeout=20).read()
18+
data_content = response
19+
# print(data_content)
20+
21+
# page = urlopen(URL)
22+
soup = BeautifulSoup(data_content,'html.parser')
23+
24+
update=[]
25+
# print(soup)
26+
# print(soup.find_all('div',attrs={'class':'cb-col cb-col-100 cb-plyr-tbody cb-rank-hdr cb-lv-main'}))
27+
for score in soup.find_all('div',attrs={'class':'cb-col cb-col-100 cb-plyr-tbody cb-rank-hdr cb-lv-main'}):
28+
# print(score)
29+
header = score.find('div',attrs={'class':'cb-col-100 cb-col cb-schdl'})
30+
header=header.text.strip()
31+
32+
status = score.find('div',attrs={'class':'cb-scr-wll-chvrn cb-lv-scrs-col'})
33+
s=status.text.strip()
34+
35+
notify(header,s)
36+
time.sleep(10)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /