@pontix/adapter-infojobs 0.0.0-bootstrap.0 → 0.2.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/LICENSE +661 -0
- package/README.md +70 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/mappers.d.ts +22 -0
- package/dist/mappers.d.ts.map +1 -0
- package/dist/mappers.js +24 -0
- package/dist/mappers.js.map +1 -0
- package/dist/offers.d.ts +40 -0
- package/dist/offers.d.ts.map +1 -0
- package/dist/offers.js +91 -0
- package/dist/offers.js.map +1 -0
- package/dist/provinces.d.ts +32 -0
- package/dist/provinces.d.ts.map +1 -0
- package/dist/provinces.js +99 -0
- package/dist/provinces.js.map +1 -0
- package/dist/session.d.ts +15 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +32 -0
- package/dist/session.js.map +1 -0
- package/dist/shapes.d.ts +105 -0
- package/dist/shapes.d.ts.map +1 -0
- package/dist/shapes.js +90 -0
- package/dist/shapes.js.map +1 -0
- package/dist/tools/get-offer.d.ts +16 -0
- package/dist/tools/get-offer.d.ts.map +1 -0
- package/dist/tools/get-offer.js +83 -0
- package/dist/tools/get-offer.js.map +1 -0
- package/dist/tools/search-offers.d.ts +41 -0
- package/dist/tools/search-offers.d.ts.map +1 -0
- package/dist/tools/search-offers.js +125 -0
- package/dist/tools/search-offers.js.map +1 -0
- package/mappers.json +66 -0
- package/package.json +40 -4
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @pontix/adapter-infojobs
|
|
2
|
+
|
|
3
|
+
Searches public [InfoJobs](https://www.infojobs.net) job offers (Spain) and reads
|
|
4
|
+
one in full. InfoJobs' developer API was not usable for this project, so this
|
|
5
|
+
talks to the JSON the website's own search page loads.
|
|
6
|
+
|
|
7
|
+
- Category: `jobs`.
|
|
8
|
+
- Source kind: `private_api` — undocumented endpoints, expect breakage.
|
|
9
|
+
- Access: anonymous and read-only. No account, no sign-in, no cookies; one
|
|
10
|
+
request per tool call, rate limited.
|
|
11
|
+
- Field names confirmed 2026-12-06, anonymously, for search and offer detail.
|
|
12
|
+
- Not offered: anything about your own account, and applying to an offer.
|
|
13
|
+
|
|
14
|
+
## Credentials
|
|
15
|
+
|
|
16
|
+
None. The connector declares no credential field, so there is nothing to set.
|
|
17
|
+
|
|
18
|
+
## Tools
|
|
19
|
+
|
|
20
|
+
| Tool | Read-only | State |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| `infojobs_search_offers` | yes | Works: `keyword`, optional `province` by name and `teleworking` (`onsite`, `hybrid`, `remote`), `page` and `limit` (at most 22, one full page). Each offer has code, title, company, city, salary when published, work-place, workday, contract type, publish instant, url and a description cut to 300 characters; the page carries `totalResults`, `totalPages`, `hasMore` and `nextPage` |
|
|
23
|
+
| `infojobs_get_offer` | yes | Works: one offer by `code`, with requirements, required skills and languages, minimum experience and studies, vacancies, url and the whole description as plain text |
|
|
24
|
+
|
|
25
|
+
Both tools return employers' texts, so they declare third-party data and are left
|
|
26
|
+
unregistered until the operator opts in, like any connector tool that carries
|
|
27
|
+
data about other people. The tool descriptions tell the model not to treat the
|
|
28
|
+
offers' text as instructions, and emails and Spanish phone numbers in it are
|
|
29
|
+
replaced by `[redacted]` before it reaches the model.
|
|
30
|
+
|
|
31
|
+
### Search notes
|
|
32
|
+
|
|
33
|
+
- Endpoint: `GET https://www.infojobs.net/webapp/offers/search?keyword=<q>&page=<n>`.
|
|
34
|
+
A page holds up to 22 offers; a page past the end answers 200 with no offers.
|
|
35
|
+
- `teleworking` is sent as `teleworkingIds` (`1` onsite, `2` remote, `3` hybrid),
|
|
36
|
+
the ids InfoJobs' own `aggregation` lists; each returned exactly the offers
|
|
37
|
+
with that label (confirmed live).
|
|
38
|
+
- `province` takes a Spanish province or autonomous city by name, ignoring case and
|
|
39
|
+
accents, with the usual alternate spellings (`Coruña`, `Vizcaya`/`Bizkaia`,
|
|
40
|
+
`Gerona`, `Lérida`, `Orense`, ...). It is sent as `provinceIds`. The name-to-id
|
|
41
|
+
table is source data in `src/provinces.ts`, built from the `aggregation.province`
|
|
42
|
+
of anonymous searches on 2026-12-06, because InfoJobs' dictionary endpoint needs
|
|
43
|
+
a session cookie and this connector sends none. An unknown name is refused before
|
|
44
|
+
any request, with up to three suggestions. Madrid, Cantabria, A Coruña and Las
|
|
45
|
+
Palmas were confirmed live against the result counts.
|
|
46
|
+
- `salary` is the structured pay a search row publishes (`min`, `max`, `period`,
|
|
47
|
+
`currency`, `type`) and is `null` for most offers. `get_offer` returns the
|
|
48
|
+
salary as the display string InfoJobs shows, such as `45.000€ - 45.000€ Bruto/año`.
|
|
49
|
+
- `url` is the offer's public page without InfoJobs' tracking parameters.
|
|
50
|
+
|
|
51
|
+
### Offer notes
|
|
52
|
+
|
|
53
|
+
- Endpoint: `GET https://www.infojobs.net/webapp/3/offer-searcher/offer/<code>`.
|
|
54
|
+
The code is the `code` of a search row: letters and digits only.
|
|
55
|
+
- The description arrives as HTML and is returned as plain text, with line
|
|
56
|
+
breaks and `- ` list items kept.
|
|
57
|
+
|
|
58
|
+
## A note on the request
|
|
59
|
+
|
|
60
|
+
The site answers a request with no `User-Agent` with a 456, so the connector sends
|
|
61
|
+
an ordinary browser one beside `accept: application/json`, and nothing else: no
|
|
62
|
+
cookies, no token, no attempt to answer a challenge. If InfoJobs starts
|
|
63
|
+
challenging this traffic the tools fail with `upstream_unavailable`; the answer is
|
|
64
|
+
not to work around it.
|
|
65
|
+
|
|
66
|
+
## Field names
|
|
67
|
+
|
|
68
|
+
Every field name lives in [`mappers.json`](./mappers.json), so a rename upstream is
|
|
69
|
+
a JSON edit rather than a release. Fixtures are in `src/__fixtures__`; see its
|
|
70
|
+
README for what was scrubbed.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type InfojobsSession } from "./session.js";
|
|
2
|
+
/**
|
|
3
|
+
* InfoJobs connector.
|
|
4
|
+
*
|
|
5
|
+
* InfoJobs' developer API was not usable for this project, so this adapter reads
|
|
6
|
+
* the same public JSON the website's own search page loads, anonymously, one
|
|
7
|
+
* request per tool call and rate limited. Those endpoints are undocumented and
|
|
8
|
+
* change without notice, so every field name belongs in `mappers.json` rather
|
|
9
|
+
* than in code.
|
|
10
|
+
*
|
|
11
|
+
* There is no account in this version: no login, no cookies, nothing about the
|
|
12
|
+
* operator is sent or read. Applying to an offer is not offered.
|
|
13
|
+
*
|
|
14
|
+
* This file is the manifest and nothing else. Each tool is a file in `tools/`.
|
|
15
|
+
*/
|
|
16
|
+
declare const _default: import("@pontix/core/adapter").Adapter<InfojobsSession>;
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAIhF;;;;;;;;;;;;;GAaG;;AACH,wBAcG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineAdapter } from "@pontix/core/adapter";
|
|
2
|
+
import { ADAPTER_ID } from "./mappers.js";
|
|
3
|
+
import { createSession, SITE_ORIGIN } from "./session.js";
|
|
4
|
+
import { getOffer } from "./tools/get-offer.js";
|
|
5
|
+
import { searchOffers } from "./tools/search-offers.js";
|
|
6
|
+
/**
|
|
7
|
+
* InfoJobs connector.
|
|
8
|
+
*
|
|
9
|
+
* InfoJobs' developer API was not usable for this project, so this adapter reads
|
|
10
|
+
* the same public JSON the website's own search page loads, anonymously, one
|
|
11
|
+
* request per tool call and rate limited. Those endpoints are undocumented and
|
|
12
|
+
* change without notice, so every field name belongs in `mappers.json` rather
|
|
13
|
+
* than in code.
|
|
14
|
+
*
|
|
15
|
+
* There is no account in this version: no login, no cookies, nothing about the
|
|
16
|
+
* operator is sent or read. Applying to an offer is not offered.
|
|
17
|
+
*
|
|
18
|
+
* This file is the manifest and nothing else. Each tool is a file in `tools/`.
|
|
19
|
+
*/
|
|
20
|
+
export default defineAdapter({
|
|
21
|
+
id: ADAPTER_ID,
|
|
22
|
+
displayName: "InfoJobs",
|
|
23
|
+
homepage: SITE_ORIGIN,
|
|
24
|
+
sourceKind: "private_api",
|
|
25
|
+
category: "jobs",
|
|
26
|
+
country: "ES",
|
|
27
|
+
// The search shape and its keyword, page and teleworking parameters were
|
|
28
|
+
// captured and confirmed live on 2026-12-06, anonymously, as was the offer
|
|
29
|
+
// detail shape.
|
|
30
|
+
verifiedAt: "2026-12-06",
|
|
31
|
+
credentials: { fields: [] },
|
|
32
|
+
tools: [searchOffers, getOffer],
|
|
33
|
+
createSession,
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAwB,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,eAAe,aAAa,CAAkB;IAC5C,EAAE,EAAE,UAAU;IACd,WAAW,EAAE,UAAU;IACvB,QAAQ,EAAE,WAAW;IACrB,UAAU,EAAE,aAAa;IACzB,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,IAAI;IACb,yEAAyE;IACzE,2EAA2E;IAC3E,gBAAgB;IAChB,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IAC3B,KAAK,EAAE,CAAC,YAAY,EAAE,QAAQ,CAAC;IAC/B,aAAa;CACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MapperSet } from "@pontix/core/adapter";
|
|
2
|
+
/**
|
|
3
|
+
* The connector's own name.
|
|
4
|
+
*
|
|
5
|
+
* Here because every `applyMapper` call needs it to attribute a drift report,
|
|
6
|
+
* and this is the one module in the package that imports nothing else from it —
|
|
7
|
+
* so everything else can read it without a cycle.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ADAPTER_ID = "infojobs";
|
|
10
|
+
/**
|
|
11
|
+
* Where each field is read from.
|
|
12
|
+
*
|
|
13
|
+
* Loaded from `mappers.json` rather than written in code, because a fact about
|
|
14
|
+
* somebody else's API can then be corrected without releasing a package. Read
|
|
15
|
+
* from disk rather than imported: JSON module imports are still experimental in
|
|
16
|
+
* Node and warn on every start.
|
|
17
|
+
*
|
|
18
|
+
* The cast is not a validation, on purpose: this file ships inside the package
|
|
19
|
+
* and is as trusted as the code beside it.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MAPPERS: MapperSet;
|
|
22
|
+
//# sourceMappingURL=mappers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,aAAa,CAAC;AAErC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,EAEf,SAAS,CAAC"}
|
package/dist/mappers.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
/**
|
|
5
|
+
* The connector's own name.
|
|
6
|
+
*
|
|
7
|
+
* Here because every `applyMapper` call needs it to attribute a drift report,
|
|
8
|
+
* and this is the one module in the package that imports nothing else from it —
|
|
9
|
+
* so everything else can read it without a cycle.
|
|
10
|
+
*/
|
|
11
|
+
export const ADAPTER_ID = "infojobs";
|
|
12
|
+
/**
|
|
13
|
+
* Where each field is read from.
|
|
14
|
+
*
|
|
15
|
+
* Loaded from `mappers.json` rather than written in code, because a fact about
|
|
16
|
+
* somebody else's API can then be corrected without releasing a package. Read
|
|
17
|
+
* from disk rather than imported: JSON module imports are still experimental in
|
|
18
|
+
* Node and warn on every start.
|
|
19
|
+
*
|
|
20
|
+
* The cast is not a validation, on purpose: this file ships inside the package
|
|
21
|
+
* and is as trusted as the code beside it.
|
|
22
|
+
*/
|
|
23
|
+
export const MAPPERS = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "mappers.json"), "utf8"));
|
|
24
|
+
//# sourceMappingURL=mappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mappers.js","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AAErC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAC/B,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC7E,CAAC"}
|
package/dist/offers.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the two offer tools share: the places `mappers.json` cannot reach and
|
|
3
|
+
* the small conversions both need.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The shape of an offer code as the capture showed it: thirty lowercase letters
|
|
7
|
+
* and digits. Looser than that on purpose (length and case), because the code
|
|
8
|
+
* is a path segment and the point of checking is to keep anything else, a slash
|
|
9
|
+
* or a `..`, out of it, not to certify InfoJobs' code format.
|
|
10
|
+
*/
|
|
11
|
+
export declare const OFFER_CODE: RegExp;
|
|
12
|
+
export declare function assertOfferCode(code: string): void;
|
|
13
|
+
/** The address a code opens on the site; confirmed to answer 200 without a redirect. */
|
|
14
|
+
export declare function offerPage(code: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* The public address of a search row.
|
|
17
|
+
*
|
|
18
|
+
* The API's `link` is protocol-relative and carries tracking parameters
|
|
19
|
+
* (`applicationOrigin`, `page`, `sortBy`), so the query is dropped and the
|
|
20
|
+
* scheme added. A link that is missing, or points anywhere but infojobs.net, is
|
|
21
|
+
* replaced by the page built from the code, so a model is never handed an
|
|
22
|
+
* address the site did not write.
|
|
23
|
+
*/
|
|
24
|
+
export declare function offerUrl(link: unknown, code: string): string;
|
|
25
|
+
export declare function readKey(container: unknown, key: string): unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Replaces emails and Spanish phone numbers in text an employer wrote with
|
|
28
|
+
* `[redacted]`, so contact details never reach the model. Prices, years and
|
|
29
|
+
* versions are shorter than nine digits and are left alone.
|
|
30
|
+
*/
|
|
31
|
+
export declare function redactContacts(text: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* The offer description is rich text. A model wants the words, not the
|
|
34
|
+
* `style="margin:0px 0px 16px"`, so block ends become line breaks, list items
|
|
35
|
+
* become dashes and every other tag goes. Entities are decoded in one pass,
|
|
36
|
+
* after the tags are gone, so `<b>` stays text instead of turning back
|
|
37
|
+
* into markup. Not a sanitizer: the output is plain text for a model, never HTML.
|
|
38
|
+
*/
|
|
39
|
+
export declare function htmlToText(html: string): string;
|
|
40
|
+
//# sourceMappingURL=offers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["../src/offers.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,UAAU,QAAuB,CAAC;AAE/C,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQlD;AAED,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5D;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAGhE;AAOD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAWD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmB/C"}
|
package/dist/offers.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { PontixError } from "@pontix/core/adapter";
|
|
2
|
+
import { ADAPTER_ID } from "./mappers.js";
|
|
3
|
+
import { SITE_ORIGIN } from "./session.js";
|
|
4
|
+
/**
|
|
5
|
+
* What the two offer tools share: the places `mappers.json` cannot reach and
|
|
6
|
+
* the small conversions both need.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The shape of an offer code as the capture showed it: thirty lowercase letters
|
|
10
|
+
* and digits. Looser than that on purpose (length and case), because the code
|
|
11
|
+
* is a path segment and the point of checking is to keep anything else, a slash
|
|
12
|
+
* or a `..`, out of it, not to certify InfoJobs' code format.
|
|
13
|
+
*/
|
|
14
|
+
export const OFFER_CODE = /^[a-z0-9]{20,40}$/i;
|
|
15
|
+
export function assertOfferCode(code) {
|
|
16
|
+
if (!OFFER_CODE.test(code)) {
|
|
17
|
+
throw new PontixError("invalid_input", "code must be an offer code returned by infojobs_search_offers: letters and digits only.", { adapterId: ADAPTER_ID });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** The address a code opens on the site; confirmed to answer 200 without a redirect. */
|
|
21
|
+
export function offerPage(code) {
|
|
22
|
+
return `${SITE_ORIGIN}/of-i${code}`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The public address of a search row.
|
|
26
|
+
*
|
|
27
|
+
* The API's `link` is protocol-relative and carries tracking parameters
|
|
28
|
+
* (`applicationOrigin`, `page`, `sortBy`), so the query is dropped and the
|
|
29
|
+
* scheme added. A link that is missing, or points anywhere but infojobs.net, is
|
|
30
|
+
* replaced by the page built from the code, so a model is never handed an
|
|
31
|
+
* address the site did not write.
|
|
32
|
+
*/
|
|
33
|
+
export function offerUrl(link, code) {
|
|
34
|
+
if (typeof link === "string" && link.startsWith("//www.infojobs.net/")) {
|
|
35
|
+
return `https:${link.split("?")[0]}`;
|
|
36
|
+
}
|
|
37
|
+
return offerPage(code);
|
|
38
|
+
}
|
|
39
|
+
export function readKey(container, key) {
|
|
40
|
+
if (typeof container !== "object" || container === null)
|
|
41
|
+
return undefined;
|
|
42
|
+
return container[key];
|
|
43
|
+
}
|
|
44
|
+
const REDACTED = "[redacted]";
|
|
45
|
+
const EMAIL = /[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g;
|
|
46
|
+
/** Nine digits starting 6-9, with spaces, dots or dashes between them, and an optional +34 / 0034 prefix. */
|
|
47
|
+
const PHONE = /(?<![\w.,])(?:(?:\+|00)34[\s.-]?)?[6-9](?:[\s.-]?\d){8}(?!\d)/g;
|
|
48
|
+
/**
|
|
49
|
+
* Replaces emails and Spanish phone numbers in text an employer wrote with
|
|
50
|
+
* `[redacted]`, so contact details never reach the model. Prices, years and
|
|
51
|
+
* versions are shorter than nine digits and are left alone.
|
|
52
|
+
*/
|
|
53
|
+
export function redactContacts(text) {
|
|
54
|
+
return text.replace(EMAIL, REDACTED).replace(PHONE, REDACTED);
|
|
55
|
+
}
|
|
56
|
+
const ENTITIES = {
|
|
57
|
+
amp: "&",
|
|
58
|
+
lt: "<",
|
|
59
|
+
gt: ">",
|
|
60
|
+
quot: '"',
|
|
61
|
+
apos: "'",
|
|
62
|
+
nbsp: " ",
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The offer description is rich text. A model wants the words, not the
|
|
66
|
+
* `style="margin:0px 0px 16px"`, so block ends become line breaks, list items
|
|
67
|
+
* become dashes and every other tag goes. Entities are decoded in one pass,
|
|
68
|
+
* after the tags are gone, so `<b>` stays text instead of turning back
|
|
69
|
+
* into markup. Not a sanitizer: the output is plain text for a model, never HTML.
|
|
70
|
+
*/
|
|
71
|
+
export function htmlToText(html) {
|
|
72
|
+
const text = html
|
|
73
|
+
.replace(/<\s*br\s*\/?>/gi, "\n")
|
|
74
|
+
.replace(/<\s*li\b[^>]*>/gi, "\n- ")
|
|
75
|
+
.replace(/<\s*\/\s*(p|div|ul|ol|h[1-6])\s*>/gi, "\n\n")
|
|
76
|
+
.replace(/<[^>]*>/g, "")
|
|
77
|
+
.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (whole, entity) => {
|
|
78
|
+
if (entity.startsWith("#")) {
|
|
79
|
+
const code = entity[1] === "x" || entity[1] === "X" ? parseInt(entity.slice(2), 16) : parseInt(entity.slice(1), 10);
|
|
80
|
+
return Number.isInteger(code) && code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : whole;
|
|
81
|
+
}
|
|
82
|
+
return ENTITIES[entity.toLowerCase()] ?? whole;
|
|
83
|
+
});
|
|
84
|
+
return text
|
|
85
|
+
.split("\n")
|
|
86
|
+
.map((line) => line.trim())
|
|
87
|
+
.join("\n")
|
|
88
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
89
|
+
.trim();
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=offers.js.map
|
|
@@ -0,0 +1 @@
|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CAAC;QACrG,CAAC;QACD,OAAO,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,KAAK,CAAC;IACjD,CAAC,CAAC,CAAC;IACL,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,IAAI,CAAC,IAAI,CAAC;SACV,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InfoJobs' province ids, as `provinceIds` takes them.
|
|
3
|
+
*
|
|
4
|
+
* Source data, not a runtime lookup: the site's own dictionary endpoint
|
|
5
|
+
* (`web.gw.infojobs.net/2/dictionary/province`) answers 500 without a CSRF
|
|
6
|
+
* session cookie, and this connector sends no cookies. The pairs are the
|
|
7
|
+
* `aggregation.province` `{ value, label }` of anonymous searches of
|
|
8
|
+
* `GET /webapp/offers/search` with four broad keywords (none, "administrativo",
|
|
9
|
+
* "comercial", "camarero"), recorded on 2026-12-06. Ids 2 to 53 are Spain's 52
|
|
10
|
+
* provinces and autonomous cities; id 1 is "Otro País" and the rest are foreign
|
|
11
|
+
* regions, none of which is offered. Confirmed to filter live: Madrid (33),
|
|
12
|
+
* Cantabria (13), A Coruña (28) and Las Palmas (20) each returned a result total
|
|
13
|
+
* equal to that province's aggregation count, with only places of that province
|
|
14
|
+
* in the first page. If InfoJobs renumbers them, correct this file.
|
|
15
|
+
*
|
|
16
|
+
* `names` are the spellings accepted besides the case- and accent-insensitive
|
|
17
|
+
* label itself: each half of a bilingual label, and the older Spanish forms.
|
|
18
|
+
*/
|
|
19
|
+
export interface Province {
|
|
20
|
+
readonly id: number;
|
|
21
|
+
/** The label InfoJobs shows. */
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly names: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
export declare const PROVINCES: readonly Province[];
|
|
26
|
+
/** Lower case, no accents, single spaces, no punctuation: what two spellings of one name share. */
|
|
27
|
+
export declare function normalizeName(name: string): string;
|
|
28
|
+
/** Up to `limit` province labels whose names are nearest to `name`, nearest first. */
|
|
29
|
+
export declare function closestProvinces(name: string, limit?: number): string[];
|
|
30
|
+
/** The InfoJobs id for a province name, or `invalid_input` suggesting the nearest few. */
|
|
31
|
+
export declare function provinceId(name: string): number;
|
|
32
|
+
//# sourceMappingURL=provinces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provinces.d.ts","sourceRoot":"","sources":["../src/provinces.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,eAAO,MAAM,SAAS,EAAE,SAAS,QAAQ,EAqDxC,CAAC;AAEF,mGAAmG;AACnG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOlD;AA0BD,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,EAAE,CAYlE;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ/C"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { PontixError } from "@pontix/core/adapter";
|
|
2
|
+
import { ADAPTER_ID } from "./mappers.js";
|
|
3
|
+
export const PROVINCES = [
|
|
4
|
+
{ id: 2, label: "Álava/Araba", names: ["Álava", "Araba"] },
|
|
5
|
+
{ id: 3, label: "Albacete", names: [] },
|
|
6
|
+
{ id: 4, label: "Alicante/Alacant", names: ["Alicante", "Alacant"] },
|
|
7
|
+
{ id: 5, label: "Almería", names: [] },
|
|
8
|
+
{ id: 6, label: "Asturias", names: ["Principado de Asturias", "Oviedo"] },
|
|
9
|
+
{ id: 7, label: "Ávila", names: [] },
|
|
10
|
+
{ id: 8, label: "Badajoz", names: [] },
|
|
11
|
+
{ id: 9, label: "Barcelona", names: [] },
|
|
12
|
+
{ id: 10, label: "Burgos", names: [] },
|
|
13
|
+
{ id: 11, label: "Cáceres", names: [] },
|
|
14
|
+
{ id: 12, label: "Cádiz", names: [] },
|
|
15
|
+
{ id: 13, label: "Cantabria", names: [] },
|
|
16
|
+
{ id: 14, label: "Castellón/Castelló", names: ["Castellón", "Castelló"] },
|
|
17
|
+
{ id: 15, label: "Ceuta", names: [] },
|
|
18
|
+
{ id: 16, label: "Ciudad Real", names: [] },
|
|
19
|
+
{ id: 17, label: "Córdoba", names: [] },
|
|
20
|
+
{ id: 18, label: "Cuenca", names: [] },
|
|
21
|
+
{ id: 19, label: "Girona", names: ["Gerona"] },
|
|
22
|
+
{ id: 20, label: "Las Palmas", names: ["Las Palmas de Gran Canaria", "Gran Canaria"] },
|
|
23
|
+
{ id: 21, label: "Granada", names: [] },
|
|
24
|
+
{ id: 22, label: "Guadalajara", names: [] },
|
|
25
|
+
{ id: 23, label: "Guipúzcoa/Gipuzkoa", names: ["Guipúzcoa", "Gipuzkoa"] },
|
|
26
|
+
{ id: 24, label: "Huelva", names: [] },
|
|
27
|
+
{ id: 25, label: "Huesca", names: [] },
|
|
28
|
+
{ id: 26, label: "Islas Baleares/Illes Balears", names: ["Baleares", "Islas Baleares", "Illes Balears", "Mallorca"] },
|
|
29
|
+
{ id: 27, label: "Jaén", names: [] },
|
|
30
|
+
{ id: 28, label: "A Coruña", names: ["Coruña", "La Coruña"] },
|
|
31
|
+
{ id: 29, label: "La Rioja", names: ["Rioja"] },
|
|
32
|
+
{ id: 30, label: "León", names: [] },
|
|
33
|
+
{ id: 31, label: "Lleida", names: ["Lérida"] },
|
|
34
|
+
{ id: 32, label: "Lugo", names: [] },
|
|
35
|
+
{ id: 33, label: "Madrid", names: [] },
|
|
36
|
+
{ id: 34, label: "Málaga", names: [] },
|
|
37
|
+
{ id: 35, label: "Melilla", names: [] },
|
|
38
|
+
{ id: 36, label: "Murcia", names: [] },
|
|
39
|
+
{ id: 37, label: "Navarra", names: ["Nafarroa"] },
|
|
40
|
+
{ id: 38, label: "Ourense", names: ["Orense"] },
|
|
41
|
+
{ id: 39, label: "Palencia", names: [] },
|
|
42
|
+
{ id: 40, label: "Pontevedra", names: [] },
|
|
43
|
+
{ id: 41, label: "Salamanca", names: [] },
|
|
44
|
+
{ id: 42, label: "Segovia", names: [] },
|
|
45
|
+
{ id: 43, label: "Sevilla", names: [] },
|
|
46
|
+
{ id: 44, label: "Soria", names: [] },
|
|
47
|
+
{ id: 45, label: "Tarragona", names: [] },
|
|
48
|
+
{ id: 46, label: "Santa Cruz de Tenerife", names: ["Tenerife"] },
|
|
49
|
+
{ id: 47, label: "Teruel", names: [] },
|
|
50
|
+
{ id: 48, label: "Toledo", names: [] },
|
|
51
|
+
{ id: 49, label: "Valencia/València", names: ["Valencia", "València"] },
|
|
52
|
+
{ id: 50, label: "Valladolid", names: [] },
|
|
53
|
+
{ id: 51, label: "Vizcaya/Bizkaia", names: ["Vizcaya", "Bizkaia"] },
|
|
54
|
+
{ id: 52, label: "Zamora", names: [] },
|
|
55
|
+
{ id: 53, label: "Zaragoza", names: [] },
|
|
56
|
+
];
|
|
57
|
+
/** Lower case, no accents, single spaces, no punctuation: what two spellings of one name share. */
|
|
58
|
+
export function normalizeName(name) {
|
|
59
|
+
return name
|
|
60
|
+
.normalize("NFD")
|
|
61
|
+
.replace(/\p{M}/gu, "")
|
|
62
|
+
.toLowerCase()
|
|
63
|
+
.replace(/[^a-z0-9]+/g, " ")
|
|
64
|
+
.trim();
|
|
65
|
+
}
|
|
66
|
+
const BY_NAME = new Map(PROVINCES.flatMap((province) => [province.label, ...province.names].map((name) => [normalizeName(name), province])));
|
|
67
|
+
function distance(a, b) {
|
|
68
|
+
let previous = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
69
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
70
|
+
const row = [i];
|
|
71
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
72
|
+
row.push(Math.min((previous[j] ?? 0) + 1, (row[j - 1] ?? 0) + 1, (previous[j - 1] ?? 0) + (a[i - 1] === b[j - 1] ? 0 : 1)));
|
|
73
|
+
}
|
|
74
|
+
previous = row;
|
|
75
|
+
}
|
|
76
|
+
return previous[b.length] ?? 0;
|
|
77
|
+
}
|
|
78
|
+
/** Up to `limit` province labels whose names are nearest to `name`, nearest first. */
|
|
79
|
+
export function closestProvinces(name, limit = 3) {
|
|
80
|
+
const wanted = normalizeName(name);
|
|
81
|
+
const scored = new Map();
|
|
82
|
+
for (const [known, province] of BY_NAME) {
|
|
83
|
+
// A prefix or containment is a better hint than edit distance alone.
|
|
84
|
+
const score = known.includes(wanted) || wanted.includes(known) ? 0 : distance(wanted, known);
|
|
85
|
+
scored.set(province.label, Math.min(scored.get(province.label) ?? Infinity, score));
|
|
86
|
+
}
|
|
87
|
+
return [...scored.entries()]
|
|
88
|
+
.sort((a, b) => a[1] - b[1] || a[0].localeCompare(b[0]))
|
|
89
|
+
.slice(0, limit)
|
|
90
|
+
.map(([label]) => label);
|
|
91
|
+
}
|
|
92
|
+
/** The InfoJobs id for a province name, or `invalid_input` suggesting the nearest few. */
|
|
93
|
+
export function provinceId(name) {
|
|
94
|
+
const found = BY_NAME.get(normalizeName(name));
|
|
95
|
+
if (found !== undefined)
|
|
96
|
+
return found.id;
|
|
97
|
+
throw new PontixError("invalid_input", `Unknown province "${name.slice(0, 60)}". Closest: ${closestProvinces(name).join(", ")}.`, { adapterId: ADAPTER_ID });
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=provinces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provinces.js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CAAC,CAAC,CAAC;SACvD,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,EAAE,CAAC;IACzC,MAAM,IAAI,WAAW,CACnB,eAAe,EACf,qBAAqB,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EACzF,EAAE,SAAS,EAAE,UAAU,EAAE,CAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpClient, type AdapterContext, type AdapterSession } from "@pontix/core/adapter";
|
|
2
|
+
export declare const SITE_ORIGIN = "https://www.infojobs.net";
|
|
3
|
+
/**
|
|
4
|
+
* What every tool in this connector is handed.
|
|
5
|
+
*
|
|
6
|
+
* Its own module rather than a corner of `index.ts`, because each tool file
|
|
7
|
+
* needs the type and `index.ts` needs the tools — the other way round would be
|
|
8
|
+
* a cycle.
|
|
9
|
+
*/
|
|
10
|
+
export interface InfojobsSession extends AdapterSession {
|
|
11
|
+
/** Anonymous: no cookies, no token. Every endpoint this connector reads is public. */
|
|
12
|
+
readonly http: HttpClient;
|
|
13
|
+
}
|
|
14
|
+
export declare function createSession(context: AdapterContext): Promise<InfojobsSession>;
|
|
15
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG5F,eAAO,MAAM,WAAW,6BAA6B,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CA6BrF"}
|
package/dist/session.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HttpClient } from "@pontix/core/adapter";
|
|
2
|
+
import { ADAPTER_ID } from "./mappers.js";
|
|
3
|
+
export const SITE_ORIGIN = "https://www.infojobs.net";
|
|
4
|
+
export async function createSession(context) {
|
|
5
|
+
const http = new HttpClient({
|
|
6
|
+
baseUrl: SITE_ORIGIN,
|
|
7
|
+
adapterId: ADAPTER_ID,
|
|
8
|
+
limiter: context.limiter,
|
|
9
|
+
logger: context.logger,
|
|
10
|
+
// There is no login: anyone browsing infojobs.net reads these two endpoints
|
|
11
|
+
// without an account. The site answers a request with no User-Agent at all
|
|
12
|
+
// with a 456, so the one header sent besides `accept` is an ordinary browser
|
|
13
|
+
// one. Nothing here defeats a challenge; it only declines to look like a
|
|
14
|
+
// script that forgot to introduce itself.
|
|
15
|
+
defaultHeaders: {
|
|
16
|
+
accept: "application/json",
|
|
17
|
+
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
http,
|
|
22
|
+
async healthcheck() {
|
|
23
|
+
// Deliberately unparsed: a shape change should surface from a tool the
|
|
24
|
+
// user called, not as a server that refuses to start.
|
|
25
|
+
await http.request("/webapp/offers/search", { query: { keyword: "a", page: 1 } });
|
|
26
|
+
},
|
|
27
|
+
async close() {
|
|
28
|
+
// No persistent connection to release.
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4C,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,WAAW,GAAG,0BAA0B,CAAC;AActD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAuB;IACzD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC;QAC1B,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE,UAAU;QACrB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,4EAA4E;QAC5E,2EAA2E;QAC3E,6EAA6E;QAC7E,yEAAyE;QACzE,0CAA0C;QAC1C,cAAc,EAAE;YACd,MAAM,EAAE,kBAAkB;YAC1B,YAAY,EACV,mHAAmH;SACtH;KACF,CAAC,CAAC;IAEH,OAAO;QACL,IAAI;QACJ,KAAK,CAAC,WAAW;YACf,uEAAuE;YACvE,sDAAsD;YACtD,MAAM,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,KAAK,CAAC,KAAK;YACT,uCAAuC;QACzC,CAAC;KACF,CAAC;AACJ,CAAC"}
|