Skip to content

Commit a37cf86

Browse files
authored
Merge pull request HarshCasper#412 from rutujadhanawade/cricbuzz
Python script to get live score
2 parents c4608f0 + c5985ae commit a37cf86

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Python/CRICBUZZ scraper/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Cricbuzz srapper
2+
3+
This python script will scrap cricbuzz.com to get live scores.
4+
5+
## Technologies used:
6+
- urllib.request
7+
- BeautifulSoup
8+
9+
## Run the script :
10+
```sh
11+
$ python3 cric_buzz.py
12+
```

Python/CRICBUZZ scraper/crik_buzz.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
''' Python script to get live cricket score
2+
'''
3+
from urllib.request import urlopen
4+
from bs4 import BeautifulSoup
5+
6+
URL = 'http://www.cricbuzz.com/cricket-match/live-scores'
7+
PAGE = urlopen(URL)
8+
SOUP = BeautifulSoup(PAGE, 'html.parser')
9+
10+
UPDATE = []
11+
12+
for score in SOUP.find_all('div', attrs={'class': 'cb-col cb-col-100 cb-lv-main'}):
13+
s = score.text.strip()
14+
UPDATE.append(s)
15+
16+
for i in enumerate(UPDATE):
17+
print(i + 1, UPDATE[i])

0 commit comments

Comments
 (0)