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

strTime is null for NHL


Posted: 08 Mar 2018 00:49

kkagill
Posts: 9
Joined: Jan 2018

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.

Posted: 09 Mar 2018 10:23

zag
Posts: 1,558
Joined: Oct 2016

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.

Posted: 09 Mar 2018 10:51

edalex
Posts: 88
Joined: Mar 2017

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

Posted: 09 Mar 2018 11:00

zag
Posts: 1,558
Joined: Oct 2016

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

Posted: 09 Mar 2018 11:06

edalex
Posts: 88
Joined: Mar 2017

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?

Posted: 09 Mar 2018 16:57

zag
Posts: 1,558
Joined: Oct 2016

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.

Posted: 09 Mar 2018 19:27

edalex
Posts: 88
Joined: Mar 2017

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?

Posted: 10 Mar 2018 10:18

zag
Posts: 1,558
Joined: Oct 2016

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

Comma would be easier as a seperator though.

Posted: 10 Mar 2018 11:51

edalex
Posts: 88
Joined: Mar 2017

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]

Posted: 10 Mar 2018 13:08

zag
Posts: 1,558
Joined: Oct 2016

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

Posted: 10 Mar 2018 13:34

edalex
Posts: 88
Joined: Mar 2017

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

Posted: 10 Mar 2018 13:42

zag
Posts: 1,558
Joined: Oct 2016

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?

Posted: 10 Mar 2018 13:49

edalex
Posts: 88
Joined: Mar 2017

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

Posted: 13 Mar 2018 14:50

edalex
Posts: 88
Joined: Mar 2017



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

Posted: 14 Mar 2018 16:11

zag
Posts: 1,558
Joined: Oct 2016

Do you have a similar schedule for NHL?

Posted: 14 Mar 2018 20:03

edalex
Posts: 88
Joined: Mar 2017

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

Posted: 14 Mar 2018 20:42

edalex
Posts: 88
Joined: Mar 2017

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

Posted: 14 Mar 2018 21:29

edalex
Posts: 88
Joined: Mar 2017

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


Who is Online?

In total there are 68 users online :: 3 registered, 0 hidden and 65 guests (based on users active over the past 5 minutes) Most users ever online was 424 on Fri Nov 10, 2017 9:02 pm

About Us

Discussion forum for TheSportsDB.com site and related topics

Rules

- Be Polite
- Respect other users
- Always post log files with issues
- Try to be helpful
- No Piracy discussion

Showing 0 to 18 (Total: 18)