Closed grantephross closed 2 years ago
The idea behind this is the time output from get_matches() doesn't retrieve a value from HLTV that matches the timezone of your bot. Getting the countdown timer allows for using datetime to get a current time from your machine and you can run automations knowing when a match is going to happen.
I hope you find this helpful :)
Hey @grantephross , thanks for the contribution!
Can I ask for some screenshots/details on where the time/dates do not match? HLTV should identify your timezone accordingly and the script should not and it does not 'translate/convert' any dates, we merely just output what HLTV gives us and has seemed to match always. (at least we've never gotten any complains, unless whoever uses the script does their own magic)
e.g:
I also think that your code makes more sense to exist within another function instead of being standalone for example within get_matches if countdown is available.
Let me know if this makes sense and I can whip something up with you :)
https://github.com/SocksPls/hltv-api/pull/30/commits/312c96c59dd559970050f8beb2e3719b4b891fd9 - added it here, no need to re-query HLTV again since we already have the date/time in the right TZ If this is enough for you, please tell me and I'll close this and merge my code
I see, we are not actually, even on Portugal TZ we're getting 23h instead of 22h. Will investigate this on the side :)
Alright, all dates/times are bounded to Europe/Copenhagen
which is HLTV's preferred timezone, and get converted to your local timezone in that branch, considering that the branch has evolved a bit, I shall close this one in favor of the other.
PS: I still think after all the rewrites, a standalone function to get a match countdown that takes in a match ID and spits out a countdown in your TZ is viable. I'll do this on Monday/Tuesday tops if @grantephross doesn't get around to it in the meantime.
e function to get a match countdown that takes in a match ID and spits out a countdown in your TZ is viable. I'll do this on Monday/Tuesday tops if @grantephross doesn't get around to it in the me
How would you like it implemented? If my request was passable I can re-do it, if not I can try to rewrite it.
Gimme a sec, I might be able to whip up something real quick and clean it up later that suits what you originally intended
@grantephross added in https://github.com/SocksPls/hltv-api/pull/34 :)
Lets you retrieve the countdown timer from the match page by passing it the match page url.