mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2025-02-17 13:58:07 +00:00
Merge pull request #41 from divyranjan17/master
Score updates from Cricbuzz website using Python web scraping
This commit is contained in:
commit
8b9f74e2f2
14
CricBuzz_Score_Update/README.md
Normal file
14
CricBuzz_Score_Update/README.md
Normal 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)
|
||||||
|
|
20
CricBuzz_Score_Update/cricbuzz_scrap.py
Normal file
20
CricBuzz_Score_Update/cricbuzz_scrap.py
Normal 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('-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*')
|
Loading…
Reference in New Issue
Block a user