MOHAN KRISHNA

0 %
Mohan Krishna
Multimedia Professional
Ai & ML Researcher & Enthusiast
  • Residence:
    India
  • City:
    Vijayawada
  • Age:
    46
AI/ML Enthusiast. New Media Trainer, VFX Artist, Non Linear Video Editor, Graphic Designer, Sound Editor and iOS App Designer.
Telugu
English
Hindi
Tamil
Proficiency:
Graphic Design
Web Design
Video & VFX
Machine Learning
Artificial Intelligence
Digital Marketing
Areas of Interest:
Take a look at some of the things I love working on.
  • Non Linear Video Editing
  • Graphic Design
  • Web Design
  • Audio Editing
  • Content Management Systems
  • Python
  • Deep Learning
  • OpenCV
  • Image Classification

Live Cricket Score

October 8, 2022
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
from win10toast import ToastNotifier
import time
# http://www.pillalamarri.in/python/live-cricket-score/
URL = 'http://www.cricbuzz.com/cricket-match/live-scores'


def notify(title, score):
    # Function for Windows toast desktop notification
    toaster = ToastNotifier()
    # toaster.show_toast(score, "Get! Set! GO!", duration=5,icon_path='cricket.ico')
    toaster.show_toast("CRICKET LIVE SCORE",
                       score,
                       duration=30,
                       icon_path='ipl.ico')


while True:
    request = Request(URL, headers={'User-Agent': 'XYZ/3.0'})
    response = urlopen(request, timeout=20).read()
    data_content = response
    # print(data_content)

    # page = urlopen(URL)
    soup = BeautifulSoup(data_content, 'html.parser')

    update = []
    # print(soup)
    # print(soup.find_all('div',attrs={'class':'cb-col cb-col-100 cb-plyr-tbody cb-rank-hdr cb-lv-main'}))
    for score in soup.find_all(
            'div',
            attrs={
                'class':
                'cb-col cb-col-100 cb-plyr-tbody cb-rank-hdr cb-lv-main'
            }):
        # print(score)
        header = score.find('div',
                            attrs={'class': 'cb-col-100 cb-col cb-schdl'})
        header = header.text.strip()

        status = score.find('div',
                            attrs={'class': 'cb-scr-wll-chvrn cb-lv-scrs-col'})
        s = status.text.strip()

        notify(header, s)
        time.sleep(10)
# http://www.pillalamarri.in/python/live-cricket-score/
Posted in PythonTags: