Skip to content
This repository has been archived by the owner on Jan 31, 2021. It is now read-only.

Commit

Permalink
Added northwell lake success
Browse files Browse the repository at this point in the history
  • Loading branch information
99littlebugs committed Jan 11, 2021
1 parent f516dd3 commit 80a8a0f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This repository aims to solve that problem by aggregating the views of the many
## `//TODO:` :white_check_mark:
Pull requests are welcome!
1. Add all the NY state individual sites
1. Parse the addresses/location information dynamically
1. Add more private sign up websites (along with parsers to go with them)
1. Build a web front end

Expand Down
49 changes: 32 additions & 17 deletions scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,40 @@ var nyGovSites = [{
state: "NY",
zip: "11435"
}
},
{
name: "Northwell CoVID-19 Vaccination Program: Nassau County - Lake Success",
link: "https://apps.health.ny.gov/doh2/applinks/cdmspr/2/counties?OpID=50500075",
address: {
name: "Lake Success/New Hyde Park",
street: "1111 Marcus Avenue",
city: "New Hyde Park",
state: "NY",
zip: "11042"
}
}];

const events = [];

axios.get(nyGovSites[0].link).then(res => {
const $ = cheerio.load(res.data);
const eventsWeb = $(".event-type");
const events = [];
eventsWeb.each((i, element) => {
events[i] = {
name: nyGovSites[0].name,
link: nyGovSites[0].link,
address: nyGovSites[0].address,
date: $(element).find("div div:contains(Date):last").first().text(),
time: $(element).find("div div:contains(Time):last").first().text(),
available: $(element).find("button").text() !== "Event Full"
for(const site of nyGovSites){
console.log(site);
axios.get(site.link).then(res => {
const $ = cheerio.load(res.data);
const eventsWeb = $(".event-type");
for (const event of eventsWeb){
console.log(site.name);
events.push( {
name: site.name,
link: site.link,
address: site.address,
date: $(event).find("div div:contains(Date):last").first().text(),
time: $(event).find("div div:contains(Time):last").first().text(),
available: $(event).find("button").text() !== "Event Full"
})
}

const data = JSON.stringify(events, null, 2);
const filename = path.join("data", "ny_state.json");
fs.writeFileSync(path.resolve(filename), data);
});

const data = JSON.stringify(events, null, 2);
const filename = path.join("data", "ny_state.json");
fs.writeFileSync(path.resolve(filename), data);
});
}

0 comments on commit 80a8a0f

Please sign in to comment.