mirror of
https://github.com/SocksPls/hltv-api
synced 2025-04-29 15:13:08 +00:00
Update month to name function
Update month to name function to use the existing datetime import
This commit is contained in:
parent
a71ccc317e
commit
374c4f1b8e
1 changed files with 6 additions and 16 deletions
22
main.py
22
main.py
|
@ -34,22 +34,12 @@ def _padIfNeeded(numberStr: str):
|
|||
return str(numberStr)
|
||||
|
||||
def _monthNameToNumber(monthName: str):
|
||||
months = {
|
||||
'January': 1,
|
||||
'February': 2,
|
||||
'March': 3,
|
||||
'April': 4,
|
||||
'May': 5,
|
||||
'June': 6,
|
||||
'July': 7,
|
||||
'August': 8,
|
||||
'Augu': 8,
|
||||
'September': 9,
|
||||
'October': 10,
|
||||
'November': 11,
|
||||
'December': 12
|
||||
}
|
||||
return months[monthName]
|
||||
# Check for the input "Augu" and convert it to "August"
|
||||
# This is necessary because the input string may have been sanitized
|
||||
# by removing the "st" from the day numbers, such as "21st" -> "21"
|
||||
if monthName == "Augu":
|
||||
monthName = "August"
|
||||
return datetime.strptime(monthName, '%B').month
|
||||
|
||||
def get_parsed_page(url, delay=0.5):
|
||||
# This fixes a blocked by cloudflare error i've encountered
|
||||
|
|
Loading…
Add table
Reference in a new issue