Skip to content

Commit

Permalink
Updated URL to development applications PDF.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBone committed Feb 16, 2019
1 parent 359a261 commit 3313f89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
16 changes: 8 additions & 8 deletions package.json
@@ -1,17 +1,17 @@
{
"version": "1.0.0",
"version": "1.0.1",
"engines": {
"node": "10.6.0"
},
"main": "scraper.js",
"dependencies": {
"cheerio": "^0.22.0",
"moment": "^2.22.2",
"pdf2json": "^1.1.7",
"request": "^2.87.0",
"request-promise-native": "^1.0.5",
"sqlite3": "^4.0.1",
"url": "^0.11.0"
"cheerio": "0.22.0",
"moment": "2.22.2",
"pdf2json": "1.1.7",
"request": "2.87.0",
"request-promise-native": "1.0.5",
"sqlite3": "4.0.1",
"url": "0.11.0"
},
"keywords": [
"scraper",
Expand Down
9 changes: 5 additions & 4 deletions scraper.js
Expand Up @@ -11,7 +11,7 @@ let pdf2json = require("pdf2json");
let urlparser = require("url");
let moment = require("moment");

const DevelopmentApplicationsUrl = "https://www.ahc.sa.gov.au/Resident/planning-and-building/the-development-process/development-applications/development-applications-register";
const DevelopmentApplicationsUrl = "https://www.ahc.sa.gov.au/Resident/planning-and-building/development-applications/development-applications-register";
const CommentUrl = "mailto:mail@ahc.sa.gov.au";

// Sets up an sqlite database.
Expand Down Expand Up @@ -71,9 +71,10 @@ async function main() {
let $ = cheerio.load(body);

let relativePdfUrl = null;
$("a[href$='.pdf']").each((index, element) => {
if ($(element).text().includes("Register"))
relativePdfUrl = element.attribs.href;
$("a").each((index, element) => {
if (element.attribs.href.toLowerCase().includes(".pdf"))
if ($(element).text().includes("Register"))
relativePdfUrl = element.attribs.href;
});

if (relativePdfUrl === null) {
Expand Down

0 comments on commit 3313f89

Please sign in to comment.