def path_from_match_url(url): m = re.findall('[\w\d\-\#\;\.]+', url) if not m: return '' if m[0] == 'http': del m[0] if m[0] == 'www.oddsportal.com' or m[0] == 'oddsportal.com': del m[0] if '#' in m[-1]: del m[-1] return odds_options.odds_path() + '/'.join(m) + '.json'
def path_from_season_url(url): m = re.findall('[\w\d\-\.]+', url) if not m: return '' if m[0] == 'http': del m[0] if m[0] == 'www.oddsportal.com' or m[0] == 'oddsportal.com': del m[0] pos = m.index('results') if pos > -1: del m[pos:] return odds_options.odds_path() + '/'.join(m) + '.json'