Skip to content

Commit 1b81895

Browse files
committed
fix(WhoScored): update URL parsing
1 parent 9576fe8 commit 1b81895

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

soccerdata/whoscored.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
import numpy as np
1212
import pandas as pd
1313
from lxml import html
14-
from selenium.common.exceptions import ElementClickInterceptedException, NoSuchElementException
14+
from selenium.common.exceptions import (
15+
ElementClickInterceptedException,
16+
NoSuchElementException,
17+
)
1518
from selenium.webdriver.common.by import By
1619

1720
from ._common import BaseSeleniumReader, make_game_id, standardize_colnames
@@ -88,13 +91,13 @@ def _parse_url(url: str) -> dict:
8891
"""
8992
patt = (
9093
r"^(?:https:\/\/www.whoscored.com)?\/"
91-
+ r"(?:Regions\/(\d+)\/)?"
92-
+ r"(?:Tournaments\/(\d+)\/)?"
93-
+ r"(?:Seasons\/(\d+)\/)?"
94-
+ r"(?:Stages\/(\d+)\/)?"
95-
+ r"(?:Matches\/(\d+)\/)?"
94+
+ r"(?:regions\/(\d+)\/)?"
95+
+ r"(?:tournaments\/(\d+)\/)?"
96+
+ r"(?:seasons\/(\d+)\/)?"
97+
+ r"(?:stages\/(\d+)\/)?"
98+
+ r"(?:matches\/(\d+)\/)?"
9699
)
97-
matches = re.search(patt, url)
100+
matches = re.search(patt, url, re.IGNORECASE)
98101
if matches:
99102
return {
100103
"region_id": matches.group(1),

0 commit comments

Comments
 (0)