Skip to content

Handle alerts for possible closures #1

@brianzelip

Description

@brianzelip

All Ys are closed today for some event, yet the schedule that this app scrapes doesn't reflect this. As a result the output from this app shows that there are three lap swim times today.

Check for alerts when scraping data and include any in the logged output.

Alerts are represented in a XHR response:

Request as URL

https://ymaryland.org/alerts?uri=/locations/weinbergy/weinbergschedules&_format=json

Request as fetch

await fetch("https://ymaryland.org/alerts?uri=/locations/weinbergy/weinbergschedules&_format=json", {
    "credentials": "omit",
    "headers": {
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0",
        "Accept": "application/json, text/plain, */*",
        "Accept-Language": "en-US,en;q=0.5",
        "Sec-Fetch-Dest": "empty",
        "Sec-Fetch-Mode": "cors",
        "Sec-Fetch-Site": "same-origin",
        "Sec-GPC": "1",
        "Pragma": "no-cache",
        "Cache-Control": "no-cache"
    },
    "referrer": "https://ymaryland.org/locations/weinbergy/weinbergschedules",
    "method": "GET",
    "mode": "cors"
});

Response:

{
  "header": {
    "local": [
      {
        "title": "Y ASSOCIATE APPRECIATION DAY CLOSING: OCTOBER 20th",
        "textColor": "000000",
        "bgColor": "FCAF17",
        "description": "<p>All Y family centers, program sites, classes, and activities will be closed on Friday, October 20 for Y Associate Appreciation Day. We encourage all of our associates to use this day to&nbsp;focus on their own well-being.&nbsp;Thank you for your understanding and support of our hard working team!</p>\r\n",
        "iconColor": "ED1C24",
        "linkUrl": null,
        "linkText": null,
        "id": "5458"
      }
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions