As part of my learning some more about modern web developments I’ve learnt that cookies now suck and one should use some kind of local storage in the web browser. One of them is Web Storage .
https://wtangy.se/ got some more updates over the weekend :)
Now if you choose a team in the /menu and later (from the same browser) visits https://wtangy.se/ you’ll get the results for that team. The selection can be cleared in bottom of the menu.
This is a good one!
Previous entries in this series: http://www.guldmyr.com/blog/wasthereannhlgamelastnight-com-now-using-object-storage/ and http://www.guldmyr.com/blog/wasthereannhlgamelastnight-appspot-com-fixed-working-again/
Renamed to wtangy.se
First things first! The website has been renamed to wtangy.se! Nobody in their right mind would type out
wasthereannhlgamelastnight.com.. so now it’s an acronym of wasthereannhlgameyesterday. wtangy.se . Using Sweden .se top level domain because there was an offer making it really cheap :)
Automatic testing and deployment
Second important update is that now we do some automatic testing and deployment.
This is done with travis-ci.org where one can view builds, the configuration is done in this file.
In google cloud there’s different versions of the apps deployed. If we don’t promote a version it will not be accessible from wtangy.se (or wasthereannhlgamelastnight.appspot.com) but via some other URL.
Right now the testing happens like this on every commit:
- deploy the code to a testing version (which we don’t promote)
- then we run some scripts:
- pylint on the python scripts
- an end to end test which tries to visit the website.
- if the above succeeds we do deploy to master (which we do promote)
To continue this series of blog posts about the awesome https://wasthereannhlgamelastnight.appspot.com/WINGS web site where you can see if there was in fact, an NHL game last night :)
Some background: First I had a python script that scraped the website of nhl.com and later changed that to just grab the data from the JSON REST API of nhl.com – much nicer. But it was still outputing the result to stdout as a set and a dictionary. And then I would in the application import this file to get the schedule. This was quite hacky and ugly :) But hey it worked.
As of this commit it now uses Google’s Cloud Object Storage:
- a special URL (one has to be an admin to be able to access it)
- there’s a cronjob which calls this URL once a day (22:00 in some time zone)
- when this URL is called a python script runs which:
- checks what year it is and composes the URL to the API so that we only grab this season’s games (to be a bit nicer to the API)
- does some sanity checking – that the fetched data is not empty
- extracts the dates and teams as before and writes two variables,
- one list which has the dates when there’s a game
- one dictionary which has the dates and all the games on each date
- probably the last would be enough ;)
- finally always overwrites the schedule
To only update it when there are changes would be cool as then I could notify myself (and possibly others) when there have been changes, but it would mean that the JSON dict has to be ordered, which they aren’t by default so I’d have to change some stuff. The GCSFileStat has a checksum-like metadata of the files called ETAG. But probably it would be best to first compute a checksum of the generated JSON and then add that as an extra metadata to the object as this ETAG is probably implemented differently between providers.
wasthereannhlgamelastnight.appspot.com – fixed – working again!
With NHL 2017-2018 season coming up and I had some extra spare time I thought why not finally fix this great website again :)
As NHL changed the layout of their schedule page about two seasons ago – there’s these days “infinite scrolling” or whatever it’s called when the page only loads what you see on the screen. This means it’s a bit difficult to scrape the page (but not impossible).
Lately I’ve been using REST API and JSON data for quite many things – after a short search I managed to find this hidden gem: https://statsapi.web.nhl.com/api/v1/schedule?startDate=2016-01-31&endDate=2016-02-05&expand=schedule.teams,schedule.linescore,schedule.broadcasts,schedule.ticket,schedule.game.content.media.epg&leaderCategories=&site=en_nhl&teamId=
Now that’s a link to an API provided by NHL where you get the schedule and you can filter it. I’m not sure what all the parameters do, they’re not all needed. You just need the startDate and endDate. The API also has standings and results. I have not managed to find any documentation for it. Best so far seems to be this blog post. So I’m not sure about if it’s OK to use it or if there are any restrictions.
p.s. – there is a shorter URL to the main page: https://rix.fi/nhl – but the commands – like https://wasthereannhlgamelastnight.appspot.com/MTL – does not work.
Was there an NHL game last night?
Yesterday my Internet activities was restricted unnecessarily!
While waiting for the replay of last night’s NHL game to air, I didn’t want to browse quite a large chunk of my normal Internets – because knowing the score while watching the game sucks. Unbeknownst to me – there was no game last night! Queue impatience, etc.
No more! (at least for the remainder of 2015 edition of the Stanley Cup).
Today (2015-06-07) it says YES, hopefully tomorrow (2015-06-08) it will say NO :) //update – it did!
This is my first trek into google cloudappengine thingy. Very much work in progress but it’s enough for now.
Got this for ps3 from verkkokauppa.com when it was released (yay, shipping from Åland = no taxes = lots cheaper games). Great if you live in Finland :)
Anyway, the game is pretty awesome (I haven’t played it since NHL ’94) but there are quite a lot of bugs that cause the game to freeze. For example they have this one mode where you use cards as players. Each card can only be used so many times. You use this to make a team and play tournaments, online, singleplayer whatever. Quite often when I play single player tournament the game freezes (often it sounds like the opponent hit the bar so it’s almost/probably goal). This causes a deduction of -1 in the player contracts and probably other nasty things that I haven’t bothered to check. It’s quite annoying anyway.
– Real NHL is starting soon! Too bad Kronwall got injured in Detroit, but I hope he gets back. Bertuzzi looks like he’s just getting better, see this shootout goal: http://video.redwings.nhl.com/videocenter/console?id=124735&catid=-6
Dog Days Are Over – Florence and the Machine – Just awesome.
Satellite – Leila Boussard – Also quite nice. But not as nice as ^^
Happy Tuesday :)
Saw the 3rd game in the Detroit – Phoenix Stanley Cup series this morning.
Lovely to see Helm fight like a bull and the Mule got in a nice kicker in the top shelf with that goal of his.
Time for some not so good sleeping rhythm in the next 8 weeks! Bye – bye circadian rhythm.
I like the 10.30pm games – means they start 5.30am here, which means early breakfast, watch game and then get to work :)
Who will fall, who will crush who, who will win!
(1) Washington vs (8) Rangers
(2) Philadelphia vs (7) Buffalo
(3) Boston vs (6) Montreal
(4) Pittsburgh vs (5) Tampa Bay
Washington should not have a problem with Rangers.
My bets in this conference is that the Caps, Philly, Montreal and Tampa goes through to the next round. Would be nice though to see Rangers and Buffalo beat the team above but I think that might be to push it too far.
(1) Vancouver vs (8) Chicago
(2) San Jose vs (7) Los Angeles
(3) Detroit vs (6) Phoenix
(4) Nashville vs (5) Anaheim
Chicago has a lot of good players and they have a bit of experience from the last years. But is it enough? I don’t think they’ll be able to kick Vancouver down.
Sharks or Kings.. hm. So hard. Antti Niemi in goal in Sharks might make the difference, but by default I do not like the Sharks so have to side with the Kings on this one.
Detroit will beat Phoenix, again. Please. :)
Nashville.. nobody likes Nashville huh? Very even team. As far as I can tell Nashville hasn’t been this high up ever in the post-season. Nice to see them here. I’m going to side with Anaheim on this one though, like the players there more.
Ah, finally. That felt good.
Maybe Boston was a bit down but honesly, 6-1? A few shots from Boston that hit the posts but it didn’t feel like they sent many really difficult towards Jimmy Howard.
Been a while since Red Wings won this – and especially nice to see the big names doing what they’re supposed to be doing :)
Just watched the replay of this high profile game.
The last games has been disappointing for the Red Wings, why do they always have to let in two goals in the first period?
They did this before the new goalie McDonald entered the lineup after Howard’s injury (looks like he’s on the mend, substitute goalie in this game) so wouldn’t attribute it solely to McDonald but he did screw up pretty good on that first goal Detroit let in.
Datsuyk, Holmström, Cleary, Howard and more – some quality players and they are the center of the Wings’ team. Please get better soon!
Also soo nice to see Lidström being captain, going to be very interesting to see who he picks when they start picking the members! Game is on the 30th and before it’s been kind of dull, hopefully not this time!