openplanter 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +210 -0
- package/dist/builder.d.ts +11 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/builder.js +179 -0
- package/dist/builder.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +548 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +51 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +114 -0
- package/dist/config.js.map +1 -0
- package/dist/credentials.d.ts +52 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +371 -0
- package/dist/credentials.js.map +1 -0
- package/dist/demo.d.ts +26 -0
- package/dist/demo.d.ts.map +1 -0
- package/dist/demo.js +95 -0
- package/dist/demo.js.map +1 -0
- package/dist/engine.d.ts +91 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +1036 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/investigation-tools/aph-holdings.d.ts +61 -0
- package/dist/investigation-tools/aph-holdings.d.ts.map +1 -0
- package/dist/investigation-tools/aph-holdings.js +459 -0
- package/dist/investigation-tools/aph-holdings.js.map +1 -0
- package/dist/investigation-tools/asic-officer-lookup.d.ts +42 -0
- package/dist/investigation-tools/asic-officer-lookup.d.ts.map +1 -0
- package/dist/investigation-tools/asic-officer-lookup.js +197 -0
- package/dist/investigation-tools/asic-officer-lookup.js.map +1 -0
- package/dist/investigation-tools/asx-calendar-fetcher.d.ts +42 -0
- package/dist/investigation-tools/asx-calendar-fetcher.d.ts.map +1 -0
- package/dist/investigation-tools/asx-calendar-fetcher.js +271 -0
- package/dist/investigation-tools/asx-calendar-fetcher.js.map +1 -0
- package/dist/investigation-tools/asx-parser.d.ts +66 -0
- package/dist/investigation-tools/asx-parser.d.ts.map +1 -0
- package/dist/investigation-tools/asx-parser.js +314 -0
- package/dist/investigation-tools/asx-parser.js.map +1 -0
- package/dist/investigation-tools/bulk-asx-announcements.d.ts +53 -0
- package/dist/investigation-tools/bulk-asx-announcements.d.ts.map +1 -0
- package/dist/investigation-tools/bulk-asx-announcements.js +204 -0
- package/dist/investigation-tools/bulk-asx-announcements.js.map +1 -0
- package/dist/investigation-tools/entity-resolver.d.ts +77 -0
- package/dist/investigation-tools/entity-resolver.d.ts.map +1 -0
- package/dist/investigation-tools/entity-resolver.js +346 -0
- package/dist/investigation-tools/entity-resolver.js.map +1 -0
- package/dist/investigation-tools/hotcopper-scraper.d.ts +73 -0
- package/dist/investigation-tools/hotcopper-scraper.d.ts.map +1 -0
- package/dist/investigation-tools/hotcopper-scraper.js +318 -0
- package/dist/investigation-tools/hotcopper-scraper.js.map +1 -0
- package/dist/investigation-tools/index.d.ts +15 -0
- package/dist/investigation-tools/index.d.ts.map +1 -0
- package/dist/investigation-tools/index.js +15 -0
- package/dist/investigation-tools/index.js.map +1 -0
- package/dist/investigation-tools/insider-graph.d.ts +173 -0
- package/dist/investigation-tools/insider-graph.d.ts.map +1 -0
- package/dist/investigation-tools/insider-graph.js +732 -0
- package/dist/investigation-tools/insider-graph.js.map +1 -0
- package/dist/investigation-tools/insider-suspicion-scorer.d.ts +97 -0
- package/dist/investigation-tools/insider-suspicion-scorer.d.ts.map +1 -0
- package/dist/investigation-tools/insider-suspicion-scorer.js +327 -0
- package/dist/investigation-tools/insider-suspicion-scorer.js.map +1 -0
- package/dist/investigation-tools/multi-forum-scraper.d.ts +104 -0
- package/dist/investigation-tools/multi-forum-scraper.d.ts.map +1 -0
- package/dist/investigation-tools/multi-forum-scraper.js +415 -0
- package/dist/investigation-tools/multi-forum-scraper.js.map +1 -0
- package/dist/investigation-tools/price-fetcher.d.ts +81 -0
- package/dist/investigation-tools/price-fetcher.d.ts.map +1 -0
- package/dist/investigation-tools/price-fetcher.js +268 -0
- package/dist/investigation-tools/price-fetcher.js.map +1 -0
- package/dist/investigation-tools/shared.d.ts +39 -0
- package/dist/investigation-tools/shared.d.ts.map +1 -0
- package/dist/investigation-tools/shared.js +203 -0
- package/dist/investigation-tools/shared.js.map +1 -0
- package/dist/investigation-tools/timeline-linker.d.ts +90 -0
- package/dist/investigation-tools/timeline-linker.d.ts.map +1 -0
- package/dist/investigation-tools/timeline-linker.js +219 -0
- package/dist/investigation-tools/timeline-linker.js.map +1 -0
- package/dist/investigation-tools/volume-scanner.d.ts +70 -0
- package/dist/investigation-tools/volume-scanner.d.ts.map +1 -0
- package/dist/investigation-tools/volume-scanner.js +227 -0
- package/dist/investigation-tools/volume-scanner.js.map +1 -0
- package/dist/model.d.ts +136 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +1071 -0
- package/dist/model.js.map +1 -0
- package/dist/patching.d.ts +45 -0
- package/dist/patching.d.ts.map +1 -0
- package/dist/patching.js +317 -0
- package/dist/patching.js.map +1 -0
- package/dist/prompts.d.ts +15 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +351 -0
- package/dist/prompts.js.map +1 -0
- package/dist/replay-log.d.ts +54 -0
- package/dist/replay-log.d.ts.map +1 -0
- package/dist/replay-log.js +94 -0
- package/dist/replay-log.js.map +1 -0
- package/dist/runtime.d.ts +53 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +259 -0
- package/dist/runtime.js.map +1 -0
- package/dist/settings.d.ts +39 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +146 -0
- package/dist/settings.js.map +1 -0
- package/dist/tool-defs.d.ts +58 -0
- package/dist/tool-defs.d.ts.map +1 -0
- package/dist/tool-defs.js +1029 -0
- package/dist/tool-defs.js.map +1 -0
- package/dist/tools.d.ts +72 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +1454 -0
- package/dist/tools.js.map +1 -0
- package/dist/tui.d.ts +49 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +699 -0
- package/dist/tui.js.map +1 -0
- package/package.json +126 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aph-holdings.ts – Australian Parliament House Register of Interests Scraper
|
|
3
|
+
*
|
|
4
|
+
* Scrapes and parses the APH Register of Members' / Senators' Interests to
|
|
5
|
+
* extract politician shareholdings and other financial interests.
|
|
6
|
+
*
|
|
7
|
+
* Data sources:
|
|
8
|
+
* - House of Representatives: https://www.aph.gov.au/Senators_and_Members/Members/Register
|
|
9
|
+
* - Senate: https://www.aph.gov.au/Parliamentary_Business/Committees/Senate/
|
|
10
|
+
* Senators_Interests/Senators_Interests_Register
|
|
11
|
+
*
|
|
12
|
+
* DISCLAIMER:
|
|
13
|
+
* This tool is provided for research and educational purposes only.
|
|
14
|
+
* Users are solely responsible for ensuring compliance with all applicable
|
|
15
|
+
* laws, regulations, and website terms before using this tool.
|
|
16
|
+
*/
|
|
17
|
+
import { fetchHtml, isoNow } from "./shared.js";
|
|
18
|
+
// ── Constants ────────────────────────────────────────────────────
|
|
19
|
+
const BASE_URL = "https://www.aph.gov.au";
|
|
20
|
+
/** House of Representatives register (48th Parliament) */
|
|
21
|
+
const HOUSE_REGISTER_URL = BASE_URL + "/Senators_and_Members/Members/Register";
|
|
22
|
+
/** Senate register */
|
|
23
|
+
const SENATE_REGISTER_URL = BASE_URL +
|
|
24
|
+
"/Parliamentary_Business/Committees/Senate/Senators_Interests" +
|
|
25
|
+
"/Senators_Interests_Register";
|
|
26
|
+
const DEFAULT_DELAY = 1.0;
|
|
27
|
+
// Company-name normalisation suffixes (longest first)
|
|
28
|
+
const COMPANY_SUFFIXES = [
|
|
29
|
+
"Proprietary Limited",
|
|
30
|
+
"Pty Limited",
|
|
31
|
+
"Pty Ltd",
|
|
32
|
+
"Pty. Ltd.",
|
|
33
|
+
"Pty. Ltd",
|
|
34
|
+
"Pty Ltd.",
|
|
35
|
+
"Limited",
|
|
36
|
+
"Ltd.",
|
|
37
|
+
"Ltd",
|
|
38
|
+
"Incorporated",
|
|
39
|
+
"Inc.",
|
|
40
|
+
"Inc",
|
|
41
|
+
"Corporation",
|
|
42
|
+
"Corp.",
|
|
43
|
+
"Corp",
|
|
44
|
+
"No Liability",
|
|
45
|
+
"N.L.",
|
|
46
|
+
"NL",
|
|
47
|
+
];
|
|
48
|
+
const COMPANY_SUFFIX_RE = new RegExp("\\b(?:" +
|
|
49
|
+
COMPANY_SUFFIXES.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|") +
|
|
50
|
+
")\\s*$", "i");
|
|
51
|
+
// Senate interest page section headings → our schema types
|
|
52
|
+
const SECTION_TYPE_MAP = {
|
|
53
|
+
"1": "shares",
|
|
54
|
+
"2": "other",
|
|
55
|
+
"3": "property",
|
|
56
|
+
"4": "other",
|
|
57
|
+
"5": "other",
|
|
58
|
+
"6": "other",
|
|
59
|
+
"7": "other",
|
|
60
|
+
"8": "other",
|
|
61
|
+
"9": "other",
|
|
62
|
+
"10": "other",
|
|
63
|
+
"11": "other",
|
|
64
|
+
"12": "other",
|
|
65
|
+
"13": "other",
|
|
66
|
+
"14": "other",
|
|
67
|
+
};
|
|
68
|
+
const SECTION_LABEL_MAP = {
|
|
69
|
+
"1": "shareholdings",
|
|
70
|
+
"2": "trusts",
|
|
71
|
+
"3": "real_estate",
|
|
72
|
+
"4": "directorships",
|
|
73
|
+
"5": "partnerships",
|
|
74
|
+
"6": "liabilities",
|
|
75
|
+
"7": "bonds_debentures",
|
|
76
|
+
"8": "savings_investments",
|
|
77
|
+
"9": "other_assets",
|
|
78
|
+
"10": "income_sources",
|
|
79
|
+
"11": "gifts",
|
|
80
|
+
"12": "sponsored_travel",
|
|
81
|
+
"13": "org_memberships",
|
|
82
|
+
"14": "other_interests",
|
|
83
|
+
};
|
|
84
|
+
// Regex patterns to detect nature of holding from free text
|
|
85
|
+
const NATURE_PATTERNS = [
|
|
86
|
+
{
|
|
87
|
+
nature: "spouse",
|
|
88
|
+
pattern: /\b(?:spouse|partner|wife|husband)\b/i,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
nature: "trust",
|
|
92
|
+
pattern: /\b(?:trust|trustee|SMSF|super(?:annuation)?)\b/i,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
nature: "indirect",
|
|
96
|
+
pattern: /\b(?:indirect|nominee|beneficial)\b/i,
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
// ── Helpers ──────────────────────────────────────────────────────
|
|
100
|
+
function normaliseCompany(name) {
|
|
101
|
+
let cleaned = name.trim();
|
|
102
|
+
cleaned = cleaned.replace(COMPANY_SUFFIX_RE, "").trim();
|
|
103
|
+
cleaned = cleaned.replace(/\s+/g, " ");
|
|
104
|
+
cleaned = cleaned.replace(/[,.\s]+$/, "");
|
|
105
|
+
return cleaned;
|
|
106
|
+
}
|
|
107
|
+
function inferNature(text) {
|
|
108
|
+
for (const { nature, pattern } of NATURE_PATTERNS) {
|
|
109
|
+
if (pattern.test(text))
|
|
110
|
+
return nature;
|
|
111
|
+
}
|
|
112
|
+
return "direct";
|
|
113
|
+
}
|
|
114
|
+
// ── Senate Scraping ──────────────────────────────────────────────
|
|
115
|
+
function scrapeSenateListingFromHtml(ch) {
|
|
116
|
+
const senators = [];
|
|
117
|
+
// Find the table with "senator" or "party" in its headers
|
|
118
|
+
const tables = ch("table").toArray();
|
|
119
|
+
let targetTable = null;
|
|
120
|
+
for (const tbl of tables) {
|
|
121
|
+
const headers = ch(tbl)
|
|
122
|
+
.find("th")
|
|
123
|
+
.toArray()
|
|
124
|
+
.map((th) => ch(th).text().trim().toLowerCase());
|
|
125
|
+
if (headers.includes("senator") || headers.includes("party")) {
|
|
126
|
+
targetTable = ch(tbl);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (!targetTable)
|
|
131
|
+
return senators;
|
|
132
|
+
const rows = targetTable.find("tr").toArray();
|
|
133
|
+
for (const row of rows) {
|
|
134
|
+
const cells = ch(row).find("td");
|
|
135
|
+
if (cells.length < 3)
|
|
136
|
+
continue;
|
|
137
|
+
const link = cells.eq(0).find("a").first();
|
|
138
|
+
if (!link.length)
|
|
139
|
+
continue;
|
|
140
|
+
const name = link.text().trim();
|
|
141
|
+
let href = link.attr("href") ?? "";
|
|
142
|
+
if (href && !href.startsWith("http")) {
|
|
143
|
+
href = BASE_URL + href;
|
|
144
|
+
}
|
|
145
|
+
const party = cells.eq(1).text().trim();
|
|
146
|
+
const state = cells.eq(2).text().trim();
|
|
147
|
+
senators.push({ name, party, state, url: href });
|
|
148
|
+
}
|
|
149
|
+
return senators;
|
|
150
|
+
}
|
|
151
|
+
function parseSectionTable(ch, table, holdingType, sectionLabel, holdings) {
|
|
152
|
+
const rows = table.find("tr").toArray();
|
|
153
|
+
if (!rows.length)
|
|
154
|
+
return;
|
|
155
|
+
const firstRowThs = ch(rows[0]).find("th");
|
|
156
|
+
const hasHeader = firstRowThs.length > 0;
|
|
157
|
+
const dataRows = hasHeader ? rows.slice(1) : rows;
|
|
158
|
+
for (const row of dataRows) {
|
|
159
|
+
const cells = ch(row).find("td, th").toArray();
|
|
160
|
+
if (!cells.length)
|
|
161
|
+
continue;
|
|
162
|
+
const cellTexts = cells.map((cell) => ch(cell).text().trim());
|
|
163
|
+
if (!cellTexts.some((t) => t))
|
|
164
|
+
continue;
|
|
165
|
+
if (holdingType === "shares") {
|
|
166
|
+
const entityRaw = cellTexts[0] ?? "";
|
|
167
|
+
const entity = normaliseCompany(entityRaw);
|
|
168
|
+
const detail = cellTexts[1] ?? "";
|
|
169
|
+
const nature = inferNature(cellTexts.join(" "));
|
|
170
|
+
if (entity) {
|
|
171
|
+
holdings.push({
|
|
172
|
+
type: "shares",
|
|
173
|
+
entity,
|
|
174
|
+
entity_raw: entityRaw,
|
|
175
|
+
detail,
|
|
176
|
+
nature,
|
|
177
|
+
section: sectionLabel,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else if (holdingType === "property") {
|
|
182
|
+
const detailText = cellTexts.filter((t) => t).join(" | ");
|
|
183
|
+
if (detailText) {
|
|
184
|
+
holdings.push({
|
|
185
|
+
type: "property",
|
|
186
|
+
entity: "",
|
|
187
|
+
detail: detailText,
|
|
188
|
+
nature: inferNature(detailText),
|
|
189
|
+
section: sectionLabel,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
const detailText = cellTexts.filter((t) => t).join(" | ");
|
|
195
|
+
if (detailText) {
|
|
196
|
+
const entity = normaliseCompany(cellTexts[0] ?? "");
|
|
197
|
+
holdings.push({
|
|
198
|
+
type: "other",
|
|
199
|
+
entity,
|
|
200
|
+
detail: detailText,
|
|
201
|
+
nature: inferNature(detailText),
|
|
202
|
+
section: sectionLabel,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function parseSenatorInterestsPage(ch, stub) {
|
|
209
|
+
const holdings = [];
|
|
210
|
+
// Build ordered list of section headings
|
|
211
|
+
const headingEls = ch("h3, h4").toArray();
|
|
212
|
+
const sectionHeadings = [];
|
|
213
|
+
for (const heading of headingEls) {
|
|
214
|
+
const text = ch(heading).text().trim();
|
|
215
|
+
const match = text.match(/^(\d+)\./);
|
|
216
|
+
if (!match)
|
|
217
|
+
continue;
|
|
218
|
+
const sectionNum = match[1];
|
|
219
|
+
const holdingType = SECTION_TYPE_MAP[sectionNum] ?? "other";
|
|
220
|
+
const sectionLabel = SECTION_LABEL_MAP[sectionNum] ?? "other";
|
|
221
|
+
sectionHeadings.push({
|
|
222
|
+
el: ch(heading),
|
|
223
|
+
num: sectionNum,
|
|
224
|
+
holdingType,
|
|
225
|
+
sectionLabel,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
// For each section, find content between this heading and the next
|
|
229
|
+
for (let idx = 0; idx < sectionHeadings.length; idx++) {
|
|
230
|
+
const { el: heading, holdingType, sectionLabel } = sectionHeadings[idx];
|
|
231
|
+
const nextHeading = idx + 1 < sectionHeadings.length
|
|
232
|
+
? sectionHeadings[idx + 1].el
|
|
233
|
+
: null;
|
|
234
|
+
// Collect sibling elements between this heading and the next
|
|
235
|
+
const contentElements = [];
|
|
236
|
+
let sibling = heading.next();
|
|
237
|
+
while (sibling && sibling.length) {
|
|
238
|
+
// Check if we've hit the next section heading
|
|
239
|
+
if (nextHeading && sibling.is(nextHeading))
|
|
240
|
+
break;
|
|
241
|
+
const tagName = (sibling.prop("tagName") ?? "").toLowerCase();
|
|
242
|
+
if (tagName === "h3" || tagName === "h4") {
|
|
243
|
+
const sibText = sibling.text().trim();
|
|
244
|
+
if (/^\d+\./.test(sibText))
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
contentElements.push(sibling);
|
|
248
|
+
sibling = sibling.next();
|
|
249
|
+
}
|
|
250
|
+
// Process content elements
|
|
251
|
+
for (const elem of contentElements) {
|
|
252
|
+
const tagName = (elem.prop("tagName") ?? "").toLowerCase();
|
|
253
|
+
if (tagName === "table") {
|
|
254
|
+
parseSectionTable(ch, elem, holdingType, sectionLabel, holdings);
|
|
255
|
+
}
|
|
256
|
+
else if (tagName === "ul" || tagName === "ol") {
|
|
257
|
+
const lis = elem.find("li").toArray();
|
|
258
|
+
for (const li of lis) {
|
|
259
|
+
const itemText = ch(li).text().trim();
|
|
260
|
+
if (itemText) {
|
|
261
|
+
const entity = holdingType === "shares"
|
|
262
|
+
? normaliseCompany(itemText)
|
|
263
|
+
: "";
|
|
264
|
+
holdings.push({
|
|
265
|
+
type: holdingType,
|
|
266
|
+
entity,
|
|
267
|
+
entity_raw: holdingType === "shares" ? itemText : undefined,
|
|
268
|
+
detail: itemText,
|
|
269
|
+
nature: inferNature(itemText),
|
|
270
|
+
section: sectionLabel,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
else if (tagName === "p") {
|
|
276
|
+
const pText = elem.text().trim();
|
|
277
|
+
if (pText && !pText.startsWith("Note:")) {
|
|
278
|
+
const entity = holdingType === "shares"
|
|
279
|
+
? normaliseCompany(pText)
|
|
280
|
+
: "";
|
|
281
|
+
holdings.push({
|
|
282
|
+
type: holdingType,
|
|
283
|
+
entity,
|
|
284
|
+
entity_raw: holdingType === "shares" ? pText : undefined,
|
|
285
|
+
detail: pText,
|
|
286
|
+
nature: inferNature(pText),
|
|
287
|
+
section: sectionLabel,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
else if (tagName === "div") {
|
|
292
|
+
const nestedTables = elem.find("table").toArray();
|
|
293
|
+
for (const tbl of nestedTables) {
|
|
294
|
+
parseSectionTable(ch, ch(tbl), holdingType, sectionLabel, holdings);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Deduplicate holdings (same type + entity + detail)
|
|
300
|
+
const seen = new Set();
|
|
301
|
+
const uniqueHoldings = [];
|
|
302
|
+
for (const h of holdings) {
|
|
303
|
+
const key = `${h.type}|${h.entity}|${h.detail}`;
|
|
304
|
+
if (!seen.has(key)) {
|
|
305
|
+
seen.add(key);
|
|
306
|
+
uniqueHoldings.push(h);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// Format display name from "Surname, FirstName" → "FirstName Surname"
|
|
310
|
+
const nameParts = stub.name.split(",");
|
|
311
|
+
const displayName = nameParts.length === 2
|
|
312
|
+
? `${nameParts[1].trim()} ${nameParts[0].trim()}`
|
|
313
|
+
: stub.name;
|
|
314
|
+
return {
|
|
315
|
+
name: displayName,
|
|
316
|
+
name_raw: stub.name,
|
|
317
|
+
party: stub.party,
|
|
318
|
+
chamber: "senate",
|
|
319
|
+
electorate: stub.state,
|
|
320
|
+
holdings: uniqueHoldings,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
export async function scrapeSenate(memberFilter, delay = DEFAULT_DELAY) {
|
|
324
|
+
const listing$ = await fetchHtml(SENATE_REGISTER_URL, { delay });
|
|
325
|
+
const listing = scrapeSenateListingFromHtml(listing$);
|
|
326
|
+
if (!listing.length)
|
|
327
|
+
return [];
|
|
328
|
+
const results = [];
|
|
329
|
+
for (const stub of listing) {
|
|
330
|
+
if (memberFilter &&
|
|
331
|
+
memberFilter.toLowerCase() !== "all" &&
|
|
332
|
+
!stub.name.toLowerCase().includes(memberFilter.toLowerCase())) {
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (!stub.url)
|
|
336
|
+
continue;
|
|
337
|
+
try {
|
|
338
|
+
const page$ = await fetchHtml(stub.url, { delay });
|
|
339
|
+
const member = parseSenatorInterestsPage(page$, stub);
|
|
340
|
+
results.push(member);
|
|
341
|
+
}
|
|
342
|
+
catch (err) {
|
|
343
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
344
|
+
console.error(`[ERROR] Failed to parse senator ${stub.name}: ${msg}`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return results;
|
|
348
|
+
}
|
|
349
|
+
// ── House of Representatives Scraping ────────────────────────────
|
|
350
|
+
function scrapeHouseListingFromHtml(ch) {
|
|
351
|
+
const members = [];
|
|
352
|
+
const tables = ch("table").toArray();
|
|
353
|
+
for (const table of tables) {
|
|
354
|
+
const rows = ch(table).find("tr").toArray();
|
|
355
|
+
for (const row of rows) {
|
|
356
|
+
const cells = ch(row).find("td");
|
|
357
|
+
if (cells.length < 2)
|
|
358
|
+
continue;
|
|
359
|
+
const nameCell = cells.length >= 2 ? cells.eq(1) : cells.eq(0);
|
|
360
|
+
const cellText = nameCell.text().trim();
|
|
361
|
+
if (!cellText)
|
|
362
|
+
continue;
|
|
363
|
+
// Try to find PDF link
|
|
364
|
+
let pdfUrl = "";
|
|
365
|
+
const pdfLinks = ch(row).find("a").toArray();
|
|
366
|
+
for (const a of pdfLinks) {
|
|
367
|
+
const href = ch(a).attr("href") ?? "";
|
|
368
|
+
if (/\.pdf$/i.test(href)) {
|
|
369
|
+
pdfUrl = href.startsWith("http") ? href : BASE_URL + href;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
// Parse "Surname, Title FirstName, Member for Electorate, STATE"
|
|
374
|
+
let name = cellText;
|
|
375
|
+
let electorate = "";
|
|
376
|
+
let state = "";
|
|
377
|
+
const memberForMatch = cellText.match(/Member\s+for\s+([^,]+?)(?:,\s*([A-Z]{2,3}))?$/);
|
|
378
|
+
if (memberForMatch) {
|
|
379
|
+
electorate = memberForMatch[1].trim();
|
|
380
|
+
state = memberForMatch[2] ?? "";
|
|
381
|
+
name = cellText
|
|
382
|
+
.slice(0, memberForMatch.index)
|
|
383
|
+
.trim()
|
|
384
|
+
.replace(/,\s*$/, "");
|
|
385
|
+
}
|
|
386
|
+
members.push({ name, electorate, state, pdf_url: pdfUrl });
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return members;
|
|
390
|
+
}
|
|
391
|
+
export async function scrapeHouse(memberFilter, delay = DEFAULT_DELAY) {
|
|
392
|
+
const ch = await fetchHtml(HOUSE_REGISTER_URL, { delay });
|
|
393
|
+
const listing = scrapeHouseListingFromHtml(ch);
|
|
394
|
+
if (!listing.length)
|
|
395
|
+
return [];
|
|
396
|
+
const results = [];
|
|
397
|
+
for (const stub of listing) {
|
|
398
|
+
if (memberFilter &&
|
|
399
|
+
memberFilter.toLowerCase() !== "all" &&
|
|
400
|
+
!stub.name.toLowerCase().includes(memberFilter.toLowerCase())) {
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
// Clean up name: "Surname, Hon Title" → "Title Surname"
|
|
404
|
+
const nameParts = stub.name.split(",", 2);
|
|
405
|
+
let displayName = nameParts.length === 2
|
|
406
|
+
? `${nameParts[1].trim()} ${nameParts[0].trim()}`
|
|
407
|
+
: stub.name;
|
|
408
|
+
// Remove honorific prefixes
|
|
409
|
+
displayName = displayName
|
|
410
|
+
.replace(/^(Hon\s+|Dr\s+|Mr\s+|Mrs\s+|Ms\s+|Miss\s+)+/i, "")
|
|
411
|
+
.trim();
|
|
412
|
+
results.push({
|
|
413
|
+
name: displayName,
|
|
414
|
+
name_raw: stub.name,
|
|
415
|
+
party: "",
|
|
416
|
+
chamber: "house",
|
|
417
|
+
electorate: stub.electorate,
|
|
418
|
+
state: stub.state,
|
|
419
|
+
pdf_url: stub.pdf_url,
|
|
420
|
+
holdings: [],
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
return results;
|
|
424
|
+
}
|
|
425
|
+
// ── Main entry point ─────────────────────────────────────────────
|
|
426
|
+
export async function scrapeAph(options) {
|
|
427
|
+
const member = options?.member ?? "all";
|
|
428
|
+
const chamber = options?.chamber ?? "both";
|
|
429
|
+
const delay = options?.delay ?? DEFAULT_DELAY;
|
|
430
|
+
const members = [];
|
|
431
|
+
if (chamber === "senate" || chamber === "both") {
|
|
432
|
+
try {
|
|
433
|
+
const senators = await scrapeSenate(member, delay);
|
|
434
|
+
members.push(...senators);
|
|
435
|
+
}
|
|
436
|
+
catch (err) {
|
|
437
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
438
|
+
console.error(`[ERROR] Senate scraping failed: ${msg}`);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (chamber === "house" || chamber === "both") {
|
|
442
|
+
try {
|
|
443
|
+
const house = await scrapeHouse(member, delay);
|
|
444
|
+
members.push(...house);
|
|
445
|
+
}
|
|
446
|
+
catch (err) {
|
|
447
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
448
|
+
console.error(`[ERROR] House scraping failed: ${msg}`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
scraped_at: isoNow(),
|
|
453
|
+
chamber,
|
|
454
|
+
member_filter: member,
|
|
455
|
+
total_members: members.length,
|
|
456
|
+
members,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
//# sourceMappingURL=aph-holdings.js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OAAO;QACL,UAAU,EAAE,MAAM,EAAE;QACpB,OAAO;QACP,aAAa,EAAE,MAAM;QACrB,aAAa,EAAE,OAAO,CAAC,MAAM;QAC7B,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* asic-officer-lookup.ts – Query ASIC company officer/director data by ABN or
|
|
3
|
+
* ASX ticker.
|
|
4
|
+
*
|
|
5
|
+
* Data sources:
|
|
6
|
+
* - ASIC Connect Registry Search:
|
|
7
|
+
* https://connectonline.asic.gov.au/RegistrySearch/faces/landing/SearchRegisters.jspx
|
|
8
|
+
* - Australian Business Register (ABR) JSON API:
|
|
9
|
+
* https://abr.business.gov.au/json/AbnDetails.aspx?abn=XXX&callback=callback
|
|
10
|
+
* - ASX Company Info API:
|
|
11
|
+
* https://www.asx.com.au/asx/1/company/{ticker}
|
|
12
|
+
*/
|
|
13
|
+
export interface AsxCompanyInfo {
|
|
14
|
+
name_full?: string;
|
|
15
|
+
name_short?: string;
|
|
16
|
+
industry_group_name?: string;
|
|
17
|
+
listing_date?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface AbrData {
|
|
21
|
+
Abn?: string;
|
|
22
|
+
EntityName?: string;
|
|
23
|
+
BusinessName?: Array<string | {
|
|
24
|
+
Value?: string;
|
|
25
|
+
}>;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
export interface OfficerRecord {
|
|
29
|
+
company_name: string | null;
|
|
30
|
+
abn: string | null;
|
|
31
|
+
ticker: string | null;
|
|
32
|
+
officer_name: string | null;
|
|
33
|
+
role: string | null;
|
|
34
|
+
appointment_date: string | null;
|
|
35
|
+
cessation_date: string | null;
|
|
36
|
+
_note?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function resolveTicker(ticker: string, delay?: number): Promise<AsxCompanyInfo | null>;
|
|
39
|
+
export declare function queryAbr(abn: string, delay?: number): Promise<AbrData | null>;
|
|
40
|
+
export declare function queryAsic(_searchTerm: string, delay?: number): Promise<OfficerRecord[]>;
|
|
41
|
+
export declare function lookupOfficers(abnOrTicker: string, maxResults?: number): Promise<OfficerRecord[]>;
|
|
42
|
+
//# sourceMappingURL=asic-officer-lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asic-officer-lookup.d.ts","sourceRoot":"","sources":["../../src/investigation-tools/asic-officer-lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA6BH,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAWD,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,KAA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