Site
Home / Forum / Developers / strTime is null for NHL

strTime is null for NHL


Posted: 08 Mar 2018 00:49

zag
Admin
Posts: 3,853
Joined: 2020

Hi guys, I find that NHL games don't mention about time in the API.
For ex: https://www.thesportsdb.com/api/v1/json/1/eventsday.php?d=2018-03-02&l=nhl

Can strTime be imported please? this is always null at the moment.

transparent spacer
Posted: 09 Mar 2018 10:23

zag
Admin
Posts: 3,853
Joined: 2020

The API we use doesn't have this info sadly.

You can edit the event and add a time if you want though manually. Just try to mention a timezone as well.

transparent spacer
Posted: 09 Mar 2018 10:51

zag
Admin
Posts: 3,853
Joined: 2020

The API we use doesn't have this info sadly.

You can edit the event and add a time if you want though manually. Just try to mention a timezone as well.

zag, please, look at my posts
https://www.thesportsdb.com/forum/viewt ... 5312#p5312
https://www.thesportsdb.com/forum/viewt ... 5381#p5381

transparent spacer
Posted: 09 Mar 2018 11:00

zag
Admin
Posts: 3,853
Joined: 2020

Thanks, i'm going to review and update all the importers over the Easter break.

transparent spacer
Posted: 09 Mar 2018 11:06

zag
Admin
Posts: 3,853
Joined: 2020

Thanks, i'm going to review and update all the importers over the Easter break.
Since I've already wrote little mlb and nhl importers in c# maybe I could prepare some data for import/updating if you give me needed format?

transparent spacer
Posted: 09 Mar 2018 16:57

zag
Admin
Posts: 3,853
Joined: 2020

Great! Well any format is good as long as its standardized using our naming for teams and a MYSql date format (YYYY-MM-DD). Or at the very least has the same team name shortcodes.

I can import any data, but XML is easiest. CSV and JSON is fine too.

Ideally this file would be hosted online somewhere and updated daily, but anything is useful.

I can run python and php scripts on the web server or executables as a service.

transparent spacer
Posted: 09 Mar 2018 19:27

zag
Admin
Posts: 3,853
Joined: 2020

Great! Well any format is good as long as its standardized using our naming for teams and a MYSql date format (YYYY-MM-DD). Or at the very least has the same team name shortcodes.

I can import any data, but XML is easiest. CSV and JSON is fine too.

Ideally this file would be hosted online somewhere and updated daily, but anything is useful.

I can run python and php scripts on the web server or executables as a service.

These are game date and time, home team id, away team id, home score, away score, home short name, away short name. Any more fields? Do you need colimn names here?
exe params could be
-end:2018-01-01 for end day
Is it ok?

transparent spacer
Posted: 10 Mar 2018 10:18

zag
Admin
Posts: 3,853
Joined: 2020

Yep that's perfect! Team Ids makes it very easy to import.

Comma would be easier as a seperator though.

transparent spacer
Posted: 10 Mar 2018 11:51

zag
Admin
Posts: 3,853
Joined: 2020

Ok. comma is fine
Although I'm confused with dates in api. It looks like UTC so for american leagues yesterday's games will be today. so requesting 09-03-2018 games you will receive 10-03-2018.You need to decide if it's ok.
And note the fact that MLB teams here have different short names with mlb site so you need to set right names in db for these items before import:
[quote:ph0eokzl]CHC Chicago Cubs
NYM New York Mets
NYY New York Yankees
TB Tampa Bay Rays
LAA Los Angeles Angels
SD San Diego Padres
WSH Washington Nationals
KC Kansas City Royals
LAD Los Angeles Dodgers
STL St. Louis Cardinals
CWS Chicago White Sox
SF San Francisco Giants[/quote:ph0eokzl]
And I didn't filter games status so mlb returns spring trainings. First regular games are from date 29-03-2018 I believe
And you will need .net 3.5
[attachment=0:ph0eokzl]MLBImporter.zip[/attachment:ph0eokzl]

transparent spacer
Posted: 10 Mar 2018 13:08

zag
Admin
Posts: 3,853
Joined: 2020

Cool yeh the dates should be fine

I've updated the MLB shortcodes. Let me know if there is anything else.

I tested and no errors now.

Are the scores included? All results say 0,0

transparent spacer
Posted: 10 Mar 2018 13:34

zag
Admin
Posts: 3,853
Joined: 2020

Yeah, scores should be there.
Try mlbimporter.exe -league:nhl -start:2018-03-01 -end:2018-03-10 for example.
I thino this should even work for online games

transparent spacer
Posted: 10 Mar 2018 13:42

zag
Admin
Posts: 3,853
Joined: 2020

Oh very cool!

It would be nice to include the league Name or ID in the results if it can do multiple sports.

What does it support?

transparent spacer
Posted: 10 Mar 2018 13:49

zag
Admin
Posts: 3,853
Joined: 2020

Only nhl and mlb since their api are the same becides domain name. You could check urls in sources I've posted with exe.
It will grab from one api at the same time depends of provided league switch. Mlb will be grabbed if no league input is provided

transparent spacer
Posted: 13 Mar 2018 14:50

zag
Admin
Posts: 3,853
Joined: 2020



I've updated the MLB shortcodes. Let me know if there is anything else.

I tested and no errors now.

So MLB full schedule will look like this

transparent spacer
Posted: 14 Mar 2018 16:11

zag
Admin
Posts: 3,853
Joined: 2020

Do you have a similar schedule for NHL?

transparent spacer
Posted: 14 Mar 2018 20:03

zag
Admin
Posts: 3,853
Joined: 2020

Sweet! All imported...

https://www.thesportsdb.com/league/4424

I also wrote a new MLB score importer from that API so it should auto update scores for this season. Lets wait and see

All matches before 29 of march are not from regulat season... They called "Spring Training" as you could see in API so I'm not sure the should be here

transparent spacer
Posted: 14 Mar 2018 20:42

zag
Admin
Posts: 3,853
Joined: 2020

Do you have a similar schedule for NHL?
I could easily make it with my importer.
But nhl is currently running so this data will be outdated in several hours.
Also I see you current importer have local date not utc like my grabber.
I believe db should have local date and I want to modify scrapper for it.
Same goes for mlb

transparent spacer
Posted: 14 Mar 2018 21:29

zag
Admin
Posts: 3,853
Joined: 2020

Here are files with actual game days.
Tell me what are you thinking.

transparent spacer
Showing 0 to 18 (Total: 18)