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 5824acd

Browse files
Merge pull request avinashkranjan#77 from bislara/live_score
Live score
2 parents aeea204 + cf0c1f8 commit 5824acd

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed

‎Live_Cricket_Score/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
venv/
2+
test.py

‎Live_Cricket_Score/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Cricbuzz srapper
2+
3+
This python script will scrap cricbuzz.com to get live scores of the matches.
4+
5+
## Setup
6+
7+
* Install the dependencies
8+
9+
`pip install -r requirements.txt`
10+
* Run the file
11+
12+
`python live_score.py`
13+
14+
## Screenshot
15+
16+
![image](https://user-images.githubusercontent.com/35392585/95109264-ff33ca00-0759-11eb-8a19-6a013b5f20a9.png)

‎Live_Cricket_Score/ipl.ico

181 KB
Binary file not shown.

‎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)

‎Live_Cricket_Score/requirements.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
beautifulsoup4==4.9.3
2+
bs4==0.0.1
3+
pypiwin32==223
4+
pywin32==228
5+
soupsieve==2.0.1
6+
urllib3==1.25.10
7+
win10toast==0.9

0 commit comments

Comments
(0)

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