def live_score(desc):
mid = match_id(desc)
data = c.livescore(mid)
score = {}
score['matchinfo'] = "{}, {}".format(data['matchinfo']['mnum'], data['matchinfo']['mchdesc'])
score['status'] = "{}, {}".format(data['matchinfo']['mchstate'].title(), data['matchinfo']['status'])
score['bowling'] = data['bowling']
score['batting'] = data['batting']
text = ''
text += Fore.LIGHTYELLOW_EX + score['matchinfo'] + '\n' + score['status'] + '\n\n'
text += Fore.BLUE + score['batting']['team'] + '\n' + Fore.BLACK
for scr in reversed(score['batting']['score']):
text += "{} :- {}/{} in {} overs\n".format(scr['desc'], scr['runs'], scr['wickets'], scr['overs'])
for b in reversed(score['batting']['batsman']):
text += "{} : {}({}) \n".format(b['name'].strip('*'), b['runs'], b['balls'])
text += Fore.BLUE + "\n" + score['bowling']['team'] + '\n' + Fore.BLACK
for scr in reversed(score['bowling']['score']):
text += "{} :- {}/{} in {} overs\n".format(scr['desc'], scr['runs'], scr['wickets'], scr['overs'])
for b in reversed(score['bowling']['bowler']):
text += "{} : {}/{} \n".format(b['name'].strip('*'), b['wickets'], b['runs'])
text += Fore.RESET
return text
评论列表
文章目录