pirxpilot / liftie

:ski: Clean, simple, easy to read, fast ski resort lift status.
https://liftie.info
BSD 3-Clause "New" or "Revised" License
66 stars 31 forks source link

Is this still active #29

Closed Sbphillips19 closed 4 years ago

Sbphillips19 commented 4 years ago

It's hard to tell given lifts are shut down, but the links provided are no longer active:

http://acme.com/lift/status

That leads to a dead end. I am assuming the api used just isn't active anymore, but maybe I am doing something wrong

Not sure how I would add resorts if I don't know the accurate names:

Short name of the resort [acme]:
Human readable name of the resort [Acme Ski]:
URL of the page with lift status [http://acme.com/lift/status]:

I tried by just making my own:

prompt: Short name of the resort [acme]:  Timberline
prompt: Human readable name of the resort [Acme Ski]:  Timberline Lodge
prompt: URL of the resort website [http://acme.com]:  https://www.timberlinelodge.com/
prompt: Comma separated list of tags [Colorado, Vail, New Hampshire]:  Timberline, Timberline Lodge, Oregon
prompt: Twitter handle (without @) [acme]:  timberlinelodge
prompt: Resort location [longitude, latitude]:  45.3311, -121.7110
prompt: Opening date [YYYY-MM-DD]:  2019-11-28
Generating files for Timberline Lodge
Generating /Users/stephenphillips/Desktop/liftie/lib/resorts/Timberline/index.js...
Generating /Users/stephenphillips/Desktop/liftie/lib/resorts/Timberline/resort.json...
Generating /Users/stephenphillips/Desktop/liftie/test/resorts/Timberline.js...
Fetching https://www.timberlinelodge.com/ to /Users/stephenphillips/Desktop/liftie/test/resorts/example/Timberline.html...
(node:72389) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.

This doesn't pass tests:

  1) parse Timberline
       should return lift status:

      Uncaught AssertionError: expected Object {} to equal Object { 'lift 1': 'open' }
      + expected - actual

      -{}
      +{
      +  "lift 1": "open"
      +}
pirxpilot commented 4 years ago

Yup. Absolutely active. Acme is just an example.

The test is meant to fail, since you actually need to specify the proper selector in lib/resort/timberline/index.js - something that would find the lift names and statuses on the https://www.timberlinelodge.com/conditions page...

Name of the resort should be lowercase (timberline), the URL should be the page that actually have the list status ( https://www.timberlinelodge.com/conditions ? ) The coordinates should be in latitude/longitude order (think x,y).

Open the PR with what you have already and I'll have a look.

Sbphillips19 commented 4 years ago

I am closing issue. Currently can't get it to work with timberline/ perhaps it doesn't scrape the page correctly, but I will try with a couple other resorts to see if it's just and error from me.

{
  "name": "timberline",
  "url": {
    "host": "https://www.timberlinelodge.com",
    "pathname": "/conditions"
  },
  "tags": [
    "Timberline",
    "Timberline Lodge",
    "Oregon"
  ],
  "ll": [
    -121.711,
    45.3311
  ],
  "twitter": "timberlinelodge",
  "opening": "2019-11-28"
}
pirxpilot commented 4 years ago

I added the Timberline Lodge resort and I tried to leave some breadcrumbs in the git history to clarify what needs to happen for the new resort to be added:

this is what you get after running bin/generate scripts - tests are failing and there is no status lift displayed but when you run liftie you actually can see a new resort page

here you add expected list of ski lifts to the test - now the test is still failing but you see what you are aiming for

most important one - this actually implements ski lift status parser - it adds CSS expressions that find the relevant info in the HTML - it's a creative part :smile:

extra credit - US resorts can have more precise weather forecast if there is a NOAA station nearby - all it takes to find and add it is bin/fetch-noaa --overwrite timberline-lodge

another extra credit :medal_sports: - normally just specifying position would add some webcams to the liftie page but you can also just add links to the webcams in resort.json descriptor

Please note: for some reason - probably the demise of the webcam.trave API this does not work at the moment. I'll see what I can do to fix it.