GithubHelp home page GithubHelp logo

datta07 / live-cricket-scores Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 17.06 MB

Completely for cricket loving programmers. Command line interface program for fastest live cricket scores with simple Python code.

License: MIT License

Python 100.00%
live-cricket-scores python cricket cricket-app cricket-data websocket

live-cricket-scores's Introduction

Live-Cricket-Scores

Command Line Interface program for fastest live cricket scores with simple Python program.This code is completely for cricket loving programmers.

WHEN CAN I USE

This code will works all the time during the live matchs.No more use of cricbuzz or live score app

How to use

open command line or terminal
~ pip install -r requirements.txt
~ python Criclive.py
Now enjoy the live scores......:)

DEMO

Alt Text

live-cricket-scores's People

Contributors

datta07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

live-cricket-scores's Issues

Error when running Criclive.py

Looks like there is a problem with the web socket.
I'm getting the following error, but there is nothing more I can do here as the websocket code is not avaiable.

๐Ÿฆ„ โฏ python3 Criclive.py

Traceback (most recent call last):
  File "/home/user/src/Live-Cricket-Scores/Criclive.py", line 119, in <module>
    liveProcess=CricLive('wss://criclive-72dee-43d33.firebaseio.com/.ws?ns=criclive-72dee-43d33&v=5')
  File "/home/user/src/Live-Cricket-Scores/Criclive.py", line 21, in __init__
    self.initialSetup() # Loading for initial setup
  File "/home/user/src/Live-Cricket-Scores/Criclive.py", line 42, in initialSetup
    if (data[i]['con']['mstus']=='L'):
KeyError: 'con'

Error parsing websocket output

Today it's failing when parsing the json

failed for {'rt': 'Islamabad,84,85'} issue @https://github.com/datta07/Live-Cricket-Scores/
NO MORE ONGOING LIVE MATCHS..., COME BACK LATER

Here is the output it's failing to parse

websocat -k "wss://criclive-72dee-43d33.firebaseio.com/.ws?ns=criclive-72dee-43d33&v=5"
{"t":"c","d":{"t":"h","d":{"ts":1614318408798,"v":"5","h":"s-usc1c-nss-281.firebaseio.com","s":"WqcM0AfAr1suFQvEkGfzp73uUbpu0pyd"}}}
{"t":"d","d":{"a":"s","r":0,"b":{"c":{"sdk.android.19-4-0":1}}}}
{"t":"d","d":{"r":0,"b":{"s":"ok","d":""}}}
{"t":"d","d":{"a":"q","r":1,"b":{"p":"\/","h":""}}}
{"t":"d","d":{"b":{"p":"","d":{"m":{"rt":"Islamabad,84,85"},"m1":{"ao":"2","b1s":"","b2s":"","bw":"","cd":"","con":{"g":"National Stadium, Karachi","lt":"","mf":"20","mn":"7th T20","mstus":"U","mtm":"26/02/2021 10:00","ostus":"","sr":"Pakistan Super League"},"cs":{"msg":"Please rate us 5 Star on Play Store and App Store.","ts":"004059"},"hms":"0","i":"i1","i1":{"ov":"0","sc":"0","wk":"0"},"i1b":"","i2":{"ov":"0","sc":"0","tr":"0","wk":"0"},"iov":"","lw":"","md":"","mit":"511330","mk":"0","oh":"m1_21047","os":"","p1":"","p2":"","pb":"","pt":"","rt":"Lahore,85,86","sn":"","ssns":"0","t1":{"f":"Lahore Qalandars","ic":"","n":"Lahore"},"t2":{"f":"Multan Sultan","ic":"","n":"Multan"}},"m10":{"ao":"9","b1s":"","b2s":"4,1,1,0","bw":"James Neesham","cd":"","con":{"g":"University Oval, Dunedin","lt":"New Zealand won by 4 runs","mf":"20","mn":"2nd T20I","mstus":"F","mtm":"25/02/2021 01:00","ostus":"","sr":"Australia tour of New Zealand"},"cs":{"msg":"New Zealand won by 4 runs","ts":"042322"},"hms":"1","i":"i2","i1":{"ov":"20.0","sc":"219","tr":"","wk":"7"},"i1b":"t1","i2":{"ov":"20.0","sc":"215","tr":"220","wk":"8"},"iov":"20","lw":"Stoinis 78 (38)","md":"Over   Session start    Pass/wkt        ODDS\n 0                                                       AUS 98-99\n 6               49-50            45/1          AUS 83-84                                                                                    10              76-77           85/1             NZ 78-79                                                          15            134-135       163/2            NZ 24-25                                                      20            224-225       219/7            NZ 28-29","mit":"618613","mk":"nzaus_2021_t20_02","oh":"m10_132614","os":"p1","p1":"Kane Richardson","p2":"Jhye Richardson","pb":"1,6,1,1,1,1,0,Wd,1,1,1,Wd,1,1,4,6,1,1,W,0,0,6,W,4","pt":"4,1","rt":"NZ,0,1","sn":"","ssns":"0","t1":{"f":"New Zealand","ic":"","n":"NZ"},"t2":{"f":"Australia","ic":"aus","n":"AUS"}},"m11":{"ao":"6","b1s":"","b2s":"","bw":"","cd":"","con":{"g":"National Stadium, Karachi","lt":"","mf":"20","mn":"8th T20","mstus":"U","mtm":"26/02/2021 15:00","ostus":"","sr":"Pakistan Super League"},"cs":{"msg":"Please rate us 5 Star on Play Store and App Store.","ts":"004723"},"hms":"0","i":"i1","i1":{"ov":"0","sc":"0","wk":"0"},"i1b":"","i2":{"ov":"0","sc":"0","tr":"0","wk":"0"},"iov":"","lw":"","md":"","mit":"219303","mk":"0","oh":"m11_41716","os":"","p1":"","p2":"","pb":"","pt":"","rt":"Peshawar,86,87","sn":"","ssns":"0","t1":{"f":"Peshawar Zalmi","ic":"","n":"Peshawar"},"t2":{"f":"Quetta Gladiators","ic":"quetta","n":"Quetta"}},"m12":{"ao":"5","b1s":"","b2s":"","bw":"","cd":"","con":{"g":"Sir Vivian Richards Stadium, Antigua","lt":"","mf":"50","mn":"5th Place Play off","mstus":"U","mtm":"26/02/2021 13:00","ostus":"","sr":"Super50 Cup"},"cs":{"msg":"Please rate us 5 Star on Play Store and App Store.","ts":"005855"},"hms":"0","i":"i1","i1":{"ov":"0","sc":"0","wk":"0"},"i1b":"","i2":{"ov":"0","sc":"0","tr":"0","wk":"0"},"iov":"","lw":"","md":"","mit":"005847","mk":"0","oh":"m12_52847","os":"","p1":"","p2":"","pb":"","pt":"","rt":"Barbados,54,55","sn":"","ssns":"0","t1":{"f":"Barbados","ic":"barbados","n":"Barbados"},"t2":{"f":"Leeward Islands","ic":"leeward","n":"Leeward"}},"m4":{"ao":"1","b1s":"","b2s":"","bw":"","cd":"","con":{"g":"Kingsmead, Durban","lt":"","mf":"20","mn":"14th Match","mstus":"U","mtm":"26/02/2021 08:00","ostus":"","sr":"CSA T20 Challenge"},"cs":{"msg":"Please rate us 5 Star on Play Store and App Store.","ts":"004947"},"hms":"0","i":"i1","i1":{"ov":"0","sc":"0","wk":"0"},"i1b":"","i2":{"ov":"0","sc":"0","tr":"0","wk":"0"},"iov":"","lw":"","md":"","mit":"173573","mk":"0","oh":"m4_31936","os":"","p1":"","p2":"","pb":"","pt":"","rt":"Lions,49,50","sn":"","ssns":"0","t1":{"f":"Cape Cobras","ic":"cobras","n":"Cobras"},"t2":{"f":"Lions","ic":"lions","n":"Lions"}},"m8":{"ao":"11","b1s":"81,57,6,3","b2s":"","bw":"Anrich Nortje","cd":"","con":{"g":"Kingsmead, Durban","lt":"Warriors won by 14 runs","mf":"20","mn":"13th Match","mstus":"F","mtm":"25/02/2021 12:30","ostus":"","sr":"CSA T20 Challenge"},"cs":{"msg":"Warriors won by 14 runs","ts":"161007"},"hms":"1","i":"i2","i1":{"ov":"20.0","sc":"157","wk":"8"},"i1b":"t1","i2":{"ov":"20.0","sc":"143","tr":"158","wk":"10"},"iov":"20","lw":"Budaza 0(2)","md":"Over      Session Start    Pass/Wkt          Odds      \n 0                                                           Knights 87-88\n 6                 42-43              53/0         Warriors 31-32  \n10                80-81              70/4         Warriors 94-95  \n15              104-105          100/5          Knights 94-95   \n20              144-145          157/8         Warriors 46-47","mit":"688826","mk":"0","oh":"m8_83347","os":"p1","p1":"Raynard van Tonder","p2":"","pb":"","pt":"","rt":"Warriors,0,1","sn":"","ssns":"0","t1":{"f":"Warriors","ic":"warriors","n":"Warriors"},"t2":{"f":"Knights","ic":"knights","n":"Knights"}},"m9":{"ao":"4","b1s":"","b2s":"","bw":"","cd":"","con":{"g":"Kingsmead, Durban","lt":"","mf":"20","mn":"15th Match","mstus":"U","mtm":"26/02/2021 12:30","ostus":"","sr":"CSA T20 Challenge"},"cs":{"msg":"Please rate us 5 Star on Play Store and App Store.","ts":"005330"},"hms":"0","i":"i1","i1":{"ov":"0","sc":"0","wk":"0"},"i1b":"","i2":{"ov":"0","sc":"0","tr":"0","wk":"0"},"iov":"","lw":"","md":"","mit":"183638","mk":"0","oh":"m9_42321","os":"","p1":"","p2":"","pb":"","pt":"","rt":"Titans,91,92","sn":"","ssns":"0","t1":{"f":"Dolphins","ic":"dolphins","n":"Dolphins"},"t2":{"f":"Titans","ic":"titans","n":"Titans"}}}},"a":"d"}}
{"t":"d","d":{"r":1,"b":{"s":"ok","d":{}}}}

Support for other cricket matches and websocket information request

This looks awesome, and I'd like to use it to watch test matches, but I have to ask. What is on the other end of this web socket? wss://criclive-72dee-43d33.firebaseio.com/.ws?ns=criclive-72dee-43d33&v=5
It looks like it's hosted by google. Can we know more about it? Can we adapt it for test matches around the world?

Catch keyboard interrupts and exit cleanly

At the moment ctrl-c to quit the python program is messy.

File "/usr/local/lib/python3.9/site-packages/websocket/_core.py", line 344, in recv_data_frame
frame = self.recv_frame()
File "/usr/local/lib/python3.9/site-packages/websocket/_core.py", line 378, in recv_frame
return self.frame_buffer.recv_frame()
File "/usr/local/lib/python3.9/site-packages/websocket/_abnf.py", line 361, in recv_frame
self.recv_header()
File "/usr/local/lib/python3.9/site-packages/websocket/_abnf.py", line 309, in recv_header
header = self.recv_strict(2)
File "/usr/local/lib/python3.9/site-packages/websocket/abnf.py", line 396, in recv_strict
bytes
= self.recv(min(16384, shortage))
File "/usr/local/lib/python3.9/site-packages/websocket/_core.py", line 453, in _recv
return recv(self.sock, bufsize)
File "/usr/local/lib/python3.9/site-packages/websocket/socket.py", line 102, in recv
bytes
= _recv()
File "/usr/local/lib/python3.9/site-packages/websocket/_socket.py", line 84, in _recv
return sock.recv(bufsize)
File "/usr/local/Cellar/[email protected]/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1226, in recv
return self.read(buflen)
File "/usr/local/Cellar/[email protected]/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1101, in read
return self._sslobj.read(len)
KeyboardInterrupt

Please can you catch the Keyboard interrupt and exit cleanly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.