dcstats / CBBpy

A Python-based web scraper for NCAA basketball.
MIT License
11 stars 2 forks source link

s.get_game_info always shows is_neutral as True #52

Closed jgpayne closed 5 months ago

jgpayne commented 5 months ago

s.get_game_info('401603499'), s.get_game_info('401600433'), s.get_game_info('401600428')

These all show is_neutral as True, which they are not neutral site games.

I saw you have an issue open to use neutralSite flag in the more_info object, but I am not seeing that flag in the JSON.

{'uid': 's:40~l:41~e:401603499', 'gid': '401603499', 'dt': '2024-02-28T01:00Z', 'nm': 'basketball', 'seriesNte': False, 'possAvail': False, 'seasonType': 2, 'status': {'desc': 'Final', 'det': 'Final', 'id': '3', 'state': 'post'}, 'statusState': 'post', 'tbd': False, 'tms': [{'id': '2305', 'abbrev': 'KU', 'displayName': 'Kansas Jayhawks', 'shortDisplayName': 'Kansas', 'logo': 'https://a.espncdn.com/i/teamlogos/ncaa/500/2305.png', 'teamColor': '0051ba', 'altColor': 'e8000d', 'uid': 's:40~l:41~t:2305', 'recordSummary': '', 'standingSummary': '', 'nickname': 'Kansas', 'location': 'Kansas', 'links': '/mens-college-basketball/team//id/2305/kansas-jayhawks', 'logoDk': 'https://a.espncdn.com/i/teamlogos/ncaa/500-dark/2305.png', 'records': [{'type': 'total', 'summary': '21-7', 'displayValue': '21-7'}, {'type': 'vsconf', 'summary': '9-6', 'displayValue': '9-6'}], 'isHome': True, 'rank': 7, 'linescores': [{'displayValue': '35'}, {'displayValue': '33'}], 'score': '68', 'acsblClr': '#0051ba', 'ltMdAcsblClr': '#0051ba', 'logoMd': 'https://a.espncdn.com/combiner/i?img=/i/teamlogos/ncaa/500/2305.png&cquality=80&h=64&w=64'}, {'id': '252', 'abbrev': 'BYU', 'displayName': 'BYU Cougars', 'shortDisplayName': 'BYU', 'logo': 'https://a.espncdn.com/i/teamlogos/ncaa/500/252.png', 'teamColor': '003da5', 'altColor': 'ffffff', 'uid': 's:40~l:41~t:252', 'recordSummary': '', 'standingSummary': '', 'nickname': 'BYU', 'location': 'BYU', 'links': '/mens-college-basketball/team//id/252/byu-cougars', 'logoDk': 'https://a.espncdn.com/i/teamlogos/ncaa/500-dark/252.png', 'records': [{'type': 'total', 'summary': '20-8', 'displayValue': '20-8'}, {'type': 'vsconf', 'summary': '8-7', 'displayValue': '8-7'}], 'isHome': False, 'linescores': [{'displayValue': '29'}, {'displayValue': '47'}], 'score': '76', 'winner': True, 'acsblClr': '#003da5', 'ltMdAcsblClr': '#003da5', 'logoMd': 'https://a.espncdn.com/combiner/i?img=/i/teamlogos/ncaa/500/252.png&cquality=80&h=64&w=64'}], 'isConferenceGame': True, 'bxscrSrc': 'full'}

dcstats commented 5 months ago

Good catch, yeah the neutral site flag I believe only appears for neutral site games, so the logic would be to check for that flag and if it's there then it's a neutral site game. I'll look into this👍🏻

jgpayne commented 5 months ago

From my very brief testing, looks like you can change the current logic for determining is_netural to

if 'neutralSite' in more_info:
    is_neutral = True
else:
    is_neutral = False
dcstats commented 5 months ago

@jgpayne I was thinking the same thing, good call. will add for the next release

dcstats commented 5 months ago

fixed with 5e8dfd0