Merge pull request #41 from divyranjan17/master

Score updates from Cricbuzz website using Python web scraping
This commit is contained in:
Ayush Bhardwaj 2018-10-06 13:28:13 +05:30 committed by GitHub
commit 8b9f74e2f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,14 @@
# Cric-Update
This python script, based on web scraping, fetches the score of the recent cricket matches using Beautiful soup library to scrape the data.
# How to run
Type in this command in terminal.
python3 cricbuzz_scrap.py
It will display score updates of all the recent matches.
![](https://d2mxuefqeaa7sj.cloudfront.net/s_78DB49E0B4D273EF775E6D44076B0924AC39C7C9CAE0AA84C9E4F68389263AD8_1532542514744_Screenshot+from+2018-07-25+23-43-29.png)

View File

@ -0,0 +1,20 @@
from urllib.request import urlopen
from bs4 import BeautifulSoup
quote_page = 'http://www.cricbuzz.com/cricket-match/live-scores'
page = urlopen(quote_page)
soup = BeautifulSoup(page,'html.parser')
update=[]
for score in soup.find_all('div',attrs={'class':'cb-col cb-col-100 cb-lv-main'}):
s=score.text.strip()
update.append(s)
print('-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*')
for i in range(len(update)):
print(i+1),
print(update[i])
print('-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*')