@chrisdothtml/job-scraper 0.0.1

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.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/dist/cache.d.ts +64 -0
  4. package/dist/cache.d.ts.map +1 -0
  5. package/dist/cache.js +146 -0
  6. package/dist/cache.js.map +1 -0
  7. package/dist/companies.d.ts +89 -0
  8. package/dist/companies.d.ts.map +1 -0
  9. package/dist/companies.js +244 -0
  10. package/dist/companies.js.map +1 -0
  11. package/dist/companies.seed.d.ts +9 -0
  12. package/dist/companies.seed.d.ts.map +1 -0
  13. package/dist/companies.seed.js +455 -0
  14. package/dist/companies.seed.js.map +1 -0
  15. package/dist/constants.d.ts +8 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/constants.js +14 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/index.d.ts +46 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +69 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/paths.d.ts +16 -0
  24. package/dist/paths.d.ts.map +1 -0
  25. package/dist/paths.js +17 -0
  26. package/dist/paths.js.map +1 -0
  27. package/dist/platform/browser.d.ts +3 -0
  28. package/dist/platform/browser.d.ts.map +1 -0
  29. package/dist/platform/browser.js +103 -0
  30. package/dist/platform/browser.js.map +1 -0
  31. package/dist/platform/node.d.ts +3 -0
  32. package/dist/platform/node.d.ts.map +1 -0
  33. package/dist/platform/node.js +106 -0
  34. package/dist/platform/node.js.map +1 -0
  35. package/dist/platform/types.d.ts +46 -0
  36. package/dist/platform/types.d.ts.map +1 -0
  37. package/dist/platform/types.js +2 -0
  38. package/dist/platform/types.js.map +1 -0
  39. package/dist/resolve.d.ts +89 -0
  40. package/dist/resolve.d.ts.map +1 -0
  41. package/dist/resolve.js +379 -0
  42. package/dist/resolve.js.map +1 -0
  43. package/dist/scrapers/AshbyScraper.d.ts +16 -0
  44. package/dist/scrapers/AshbyScraper.d.ts.map +1 -0
  45. package/dist/scrapers/AshbyScraper.js +207 -0
  46. package/dist/scrapers/AshbyScraper.js.map +1 -0
  47. package/dist/scrapers/GitHubScraper.d.ts +8 -0
  48. package/dist/scrapers/GitHubScraper.d.ts.map +1 -0
  49. package/dist/scrapers/GitHubScraper.js +61 -0
  50. package/dist/scrapers/GitHubScraper.js.map +1 -0
  51. package/dist/scrapers/GoogleScraper.d.ts +8 -0
  52. package/dist/scrapers/GoogleScraper.d.ts.map +1 -0
  53. package/dist/scrapers/GoogleScraper.js +83 -0
  54. package/dist/scrapers/GoogleScraper.js.map +1 -0
  55. package/dist/scrapers/GreenhouseScraper.d.ts +28 -0
  56. package/dist/scrapers/GreenhouseScraper.d.ts.map +1 -0
  57. package/dist/scrapers/GreenhouseScraper.js +68 -0
  58. package/dist/scrapers/GreenhouseScraper.js.map +1 -0
  59. package/dist/scrapers/LeverScraper.d.ts +13 -0
  60. package/dist/scrapers/LeverScraper.d.ts.map +1 -0
  61. package/dist/scrapers/LeverScraper.js +58 -0
  62. package/dist/scrapers/LeverScraper.js.map +1 -0
  63. package/dist/scrapers/NetflixScraper.d.ts +8 -0
  64. package/dist/scrapers/NetflixScraper.d.ts.map +1 -0
  65. package/dist/scrapers/NetflixScraper.js +60 -0
  66. package/dist/scrapers/NetflixScraper.js.map +1 -0
  67. package/dist/scrapers/NvidiaScraper.d.ts +8 -0
  68. package/dist/scrapers/NvidiaScraper.d.ts.map +1 -0
  69. package/dist/scrapers/NvidiaScraper.js +61 -0
  70. package/dist/scrapers/NvidiaScraper.js.map +1 -0
  71. package/dist/scrapers/RipplingScraper.d.ts +10 -0
  72. package/dist/scrapers/RipplingScraper.d.ts.map +1 -0
  73. package/dist/scrapers/RipplingScraper.js +64 -0
  74. package/dist/scrapers/RipplingScraper.js.map +1 -0
  75. package/dist/scrapers/Scraper.d.ts +134 -0
  76. package/dist/scrapers/Scraper.d.ts.map +1 -0
  77. package/dist/scrapers/Scraper.js +224 -0
  78. package/dist/scrapers/Scraper.js.map +1 -0
  79. package/dist/scrapers/ShopifyScraper.d.ts +16 -0
  80. package/dist/scrapers/ShopifyScraper.d.ts.map +1 -0
  81. package/dist/scrapers/ShopifyScraper.js +104 -0
  82. package/dist/scrapers/ShopifyScraper.js.map +1 -0
  83. package/dist/scrapers/SmartRecruitersScraper.d.ts +13 -0
  84. package/dist/scrapers/SmartRecruitersScraper.d.ts.map +1 -0
  85. package/dist/scrapers/SmartRecruitersScraper.js +66 -0
  86. package/dist/scrapers/SmartRecruitersScraper.js.map +1 -0
  87. package/dist/scrapers/UberScraper.d.ts +14 -0
  88. package/dist/scrapers/UberScraper.d.ts.map +1 -0
  89. package/dist/scrapers/UberScraper.js +94 -0
  90. package/dist/scrapers/UberScraper.js.map +1 -0
  91. package/dist/scrapers/WorkableScraper.d.ts +12 -0
  92. package/dist/scrapers/WorkableScraper.d.ts.map +1 -0
  93. package/dist/scrapers/WorkableScraper.js +67 -0
  94. package/dist/scrapers/WorkableScraper.js.map +1 -0
  95. package/dist/scrapers/WorkdayScraper.d.ts +14 -0
  96. package/dist/scrapers/WorkdayScraper.d.ts.map +1 -0
  97. package/dist/scrapers/WorkdayScraper.js +85 -0
  98. package/dist/scrapers/WorkdayScraper.js.map +1 -0
  99. package/dist/scrapers/index.d.ts +41 -0
  100. package/dist/scrapers/index.d.ts.map +1 -0
  101. package/dist/scrapers/index.js +46 -0
  102. package/dist/scrapers/index.js.map +1 -0
  103. package/dist/search.d.ts +75 -0
  104. package/dist/search.d.ts.map +1 -0
  105. package/dist/search.js +225 -0
  106. package/dist/search.js.map +1 -0
  107. package/dist/sniff.d.ts +43 -0
  108. package/dist/sniff.d.ts.map +1 -0
  109. package/dist/sniff.js +124 -0
  110. package/dist/sniff.js.map +1 -0
  111. package/dist/utils/misc.d.ts +15 -0
  112. package/dist/utils/misc.d.ts.map +1 -0
  113. package/dist/utils/misc.js +31 -0
  114. package/dist/utils/misc.js.map +1 -0
  115. package/package.json +70 -0
@@ -0,0 +1,134 @@
1
+ export interface ListedJob {
2
+ /** Stable identifier, usable with `getJobContent` */
3
+ id: string;
4
+ title: string;
5
+ location: string;
6
+ url: string;
7
+ }
8
+ export interface Job extends ListedJob {
9
+ /** The full posting. May be plaintext, markdown, or stringified JSON */
10
+ content: string;
11
+ }
12
+ /** The pieces of a company's job board that can be recovered from a URL */
13
+ export interface ParsedUrl {
14
+ /** The board slug, as a `Scraper` constructor takes it */
15
+ slug: string;
16
+ /** The job id, when the URL points at a single posting */
17
+ jobId: string | null;
18
+ }
19
+ /** Thrown when a board has no posting under the given id */
20
+ export declare class JobNotFoundError extends Error {
21
+ jobId: string;
22
+ companySlug: string;
23
+ constructor(jobId: string, companySlug: string);
24
+ }
25
+ /**
26
+ * Thrown by a scraper's fallback path (scraping data out of a page, rather
27
+ * than a stable API) when the page loaded but didn't match the shape the
28
+ * fallback expects. This means the page changed, not that the board doesn't
29
+ * exist, so it's kept distinct from a plain miss: `hasCompanyBoard` lets it
30
+ * through instead of swallowing it, so resolution can surface it as an
31
+ * actionable error rather than a generic "not found" once nothing else
32
+ * accounts for the company either.
33
+ */
34
+ export declare class BoardShapeError extends Error {
35
+ scraperName: string;
36
+ companySlug: string;
37
+ constructor(scraperName: string, companySlug: string, message: string);
38
+ }
39
+ export declare abstract class Scraper {
40
+ protected companySlug: string;
41
+ /**
42
+ * Whether this scraper backs a multi-tenant job board whose slugs can be
43
+ * guessed from a company name. Single-company scrapers, and boards whose
44
+ * slug can't be derived (e.g. Workday), leave this false so that company
45
+ * resolution never probes them.
46
+ */
47
+ static readonly discoverable: boolean;
48
+ /**
49
+ * Hostnames this board serves. Used to build `site:`-scoped web searches
50
+ * when a company can't be found by guessing slugs. Leave empty for
51
+ * single-company scrapers; there's nothing to search for.
52
+ */
53
+ static readonly boardDomains: readonly string[];
54
+ /**
55
+ * Query params this board tags its outbound links with. When a company
56
+ * embeds the board on its own site, these often survive in the URL
57
+ * (`?gh_jid=` for Greenhouse) and are the one clue a bespoke careers domain
58
+ * gives about which board is behind it.
59
+ */
60
+ static readonly urlHintParams: readonly string[];
61
+ /**
62
+ * Board slugs worth trying for a company name, most likely first. Boards
63
+ * generally slugify the company name one of a couple of ways, so the
64
+ * default covers both; override when a board has its own convention.
65
+ */
66
+ static slugCandidates(companyName: string): string[];
67
+ /**
68
+ * Extracts the board slug (and job id, if present) from a careers or job
69
+ * posting URL. Returns null when the URL isn't served by this scraper.
70
+ */
71
+ static parseUrl(url: URL): ParsedUrl | null;
72
+ constructor(companySlug: string);
73
+ /** Frees whatever the scraper holds in memory (cached postings, say) */
74
+ dispose(): void;
75
+ /**
76
+ * Allows `using scraper = new Scraper(slug)` where the runtime supports it.
77
+ * Only declared here: it's attached below when `Symbol.dispose` exists,
78
+ * since a runtime without it (Node 22, Safari) can't define it at all.
79
+ */
80
+ [Symbol.dispose]: () => void;
81
+ /**
82
+ * Gets the full list of jobs. When `testing` is true, scrapers fetch as
83
+ * little as they can get away with (typically a single page), but a page,
84
+ * not a single job, since discovery judges a board by how many it returns.
85
+ */
86
+ abstract getJobsList(testing?: boolean): Promise<ListedJob[]>;
87
+ /**
88
+ * Gets a full job from the id. May be plaintext, markdown,
89
+ * or a stringified JSON object
90
+ */
91
+ abstract getJobContent(id: string): Promise<string>;
92
+ /** The public posting URL for a job id, when it can be built from the id alone */
93
+ jobUrl(id: string): string | null;
94
+ /**
95
+ * Looks a job up in a cache that `getJobsList` fills. Some boards only
96
+ * hand over full postings through their list endpoint, so the list is
97
+ * fetched on demand when the cache is cold; callers shouldn't have to
98
+ * know which scrapers work that way.
99
+ */
100
+ protected fromJobsList<T>(cache: Map<string, T>, id: string): Promise<NonNullable<T>>;
101
+ /**
102
+ * Whether this scraper's board actually serves the slug it was constructed
103
+ * with, and has at least `minJobs` real postings on it. Boards answer
104
+ * unknown slugs with an error or an unusable payload, both of which make
105
+ * the listing request throw. But a board existing isn't the same as a
106
+ * company using it: a trial account left behind holds a lone "Test UAT"
107
+ * posting, so placeholders don't count toward `minJobs`.
108
+ */
109
+ hasCompanyBoard(minJobs?: number): Promise<boolean>;
110
+ /**
111
+ * Gets a single job with its listing fields. Scrapers that hydrate an
112
+ * internal cache from the jobs list get one retry after listing.
113
+ */
114
+ getJob(id: string): Promise<Job>;
115
+ }
116
+ declare global {
117
+ interface SymbolConstructor {
118
+ readonly dispose: unique symbol;
119
+ }
120
+ }
121
+ /**
122
+ * The shape every concrete scraper has: constructible with a board slug,
123
+ * plus the statics that company and URL resolution rely on.
124
+ */
125
+ export interface ScraperSubclass {
126
+ new (companySlug: string): Scraper;
127
+ readonly name: string;
128
+ readonly discoverable: boolean;
129
+ readonly boardDomains: readonly string[];
130
+ readonly urlHintParams: readonly string[];
131
+ slugCandidates(companyName: string): string[];
132
+ parseUrl(url: URL): ParsedUrl | null;
133
+ }
134
+ //# sourceMappingURL=Scraper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scraper.d.ts","sourceRoot":"","sources":["../../src/scrapers/Scraper.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,GAAI,SAAQ,SAAS;IACpC,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,4DAA4D;AAC5D,qBAAa,gBAAiB,SAAQ,KAAK;IAEhC,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,MAAM;gBADnB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM;CAK7B;AAED;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SA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OAGG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAcvC;AAKD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,iBAAiB;QACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC;KACjC;CACF;AAYD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC;CACtC"}
@@ -0,0 +1,224 @@
1
+ import { CorsError } from "../cache.js";
2
+ /** Thrown when a board has no posting under the given id */
3
+ export class JobNotFoundError extends Error {
4
+ jobId;
5
+ companySlug;
6
+ constructor(jobId, companySlug) {
7
+ super(`No job '${jobId}' on board '${companySlug}'`);
8
+ this.jobId = jobId;
9
+ this.companySlug = companySlug;
10
+ this.name = 'JobNotFoundError';
11
+ }
12
+ }
13
+ /**
14
+ * Thrown by a scraper's fallback path (scraping data out of a page, rather
15
+ * than a stable API) when the page loaded but didn't match the shape the
16
+ * fallback expects. This means the page changed, not that the board doesn't
17
+ * exist, so it's kept distinct from a plain miss: `hasCompanyBoard` lets it
18
+ * through instead of swallowing it, so resolution can surface it as an
19
+ * actionable error rather than a generic "not found" once nothing else
20
+ * accounts for the company either.
21
+ */
22
+ export class BoardShapeError extends Error {
23
+ scraperName;
24
+ companySlug;
25
+ constructor(scraperName, companySlug, message) {
26
+ super(`${scraperName} fallback for '${companySlug}': ${message}`);
27
+ this.scraperName = scraperName;
28
+ this.companySlug = companySlug;
29
+ this.name = 'BoardShapeError';
30
+ }
31
+ }
32
+ export class Scraper {
33
+ companySlug;
34
+ /**
35
+ * Whether this scraper backs a multi-tenant job board whose slugs can be
36
+ * guessed from a company name. Single-company scrapers, and boards whose
37
+ * slug can't be derived (e.g. Workday), leave this false so that company
38
+ * resolution never probes them.
39
+ */
40
+ static discoverable = false;
41
+ /**
42
+ * Hostnames this board serves. Used to build `site:`-scoped web searches
43
+ * when a company can't be found by guessing slugs. Leave empty for
44
+ * single-company scrapers; there's nothing to search for.
45
+ */
46
+ static boardDomains = [];
47
+ /**
48
+ * Query params this board tags its outbound links with. When a company
49
+ * embeds the board on its own site, these often survive in the URL
50
+ * (`?gh_jid=` for Greenhouse) and are the one clue a bespoke careers domain
51
+ * gives about which board is behind it.
52
+ */
53
+ static urlHintParams = [];
54
+ /**
55
+ * Board slugs worth trying for a company name, most likely first. Boards
56
+ * generally slugify the company name one of a couple of ways, so the
57
+ * default covers both; override when a board has its own convention.
58
+ */
59
+ static slugCandidates(companyName) {
60
+ const words = companyName
61
+ .toLowerCase()
62
+ .replace(/[^a-z0-9]+/g, ' ')
63
+ .trim()
64
+ .split(' ')
65
+ .filter(Boolean);
66
+ if (words.length === 0)
67
+ return [];
68
+ return [...new Set([words.join(''), words.join('-')])];
69
+ }
70
+ /**
71
+ * Extracts the board slug (and job id, if present) from a careers or job
72
+ * posting URL. Returns null when the URL isn't served by this scraper.
73
+ */
74
+ static parseUrl(url) {
75
+ void url;
76
+ return null;
77
+ }
78
+ constructor(companySlug) {
79
+ this.companySlug = companySlug;
80
+ }
81
+ /** Frees whatever the scraper holds in memory (cached postings, say) */
82
+ dispose() { }
83
+ /** The public posting URL for a job id, when it can be built from the id alone */
84
+ jobUrl(id) {
85
+ void id;
86
+ return null;
87
+ }
88
+ /**
89
+ * Looks a job up in a cache that `getJobsList` fills. Some boards only
90
+ * hand over full postings through their list endpoint, so the list is
91
+ * fetched on demand when the cache is cold; callers shouldn't have to
92
+ * know which scrapers work that way.
93
+ */
94
+ async fromJobsList(cache, id) {
95
+ if (cache.size === 0)
96
+ await this.getJobsList();
97
+ const job = cache.get(id);
98
+ if (!job)
99
+ throw new JobNotFoundError(id, this.companySlug);
100
+ return job;
101
+ }
102
+ /**
103
+ * Whether this scraper's board actually serves the slug it was constructed
104
+ * with, and has at least `minJobs` real postings on it. Boards answer
105
+ * unknown slugs with an error or an unusable payload, both of which make
106
+ * the listing request throw. But a board existing isn't the same as a
107
+ * company using it: a trial account left behind holds a lone "Test UAT"
108
+ * posting, so placeholders don't count toward `minJobs`.
109
+ */
110
+ async hasCompanyBoard(minJobs = 1) {
111
+ try {
112
+ const jobs = await this.getJobsList(true);
113
+ if (!Array.isArray(jobs))
114
+ return false;
115
+ return jobs.filter((job) => !isPlaceholderJob(job)).length >= minJobs;
116
+ }
117
+ catch (err) {
118
+ // a fallback's page-shape mismatch is a signal worth surfacing, not a
119
+ // plain "this slug doesn't exist" miss; let it propagate. So is a
120
+ // browser blocking the board, which says nothing about the slug at all
121
+ if (err instanceof BoardShapeError || err instanceof CorsError)
122
+ throw err;
123
+ return false;
124
+ }
125
+ }
126
+ /**
127
+ * Gets a single job with its listing fields. Scrapers that hydrate an
128
+ * internal cache from the jobs list get one retry after listing.
129
+ */
130
+ async getJob(id) {
131
+ const content = await this.getJobContent(id);
132
+ // most scrapers return the board's own JSON, which already carries the
133
+ // listing fields
134
+ const fields = readListingFields(content);
135
+ return {
136
+ id,
137
+ title: fields?.title ?? '',
138
+ location: fields?.location ?? '',
139
+ url: fields?.url ?? this.jobUrl(id) ?? '',
140
+ content,
141
+ };
142
+ }
143
+ }
144
+ if (typeof Symbol.dispose === 'symbol') {
145
+ Object.defineProperty(Scraper.prototype, Symbol.dispose, {
146
+ value() {
147
+ this.dispose();
148
+ },
149
+ writable: true,
150
+ configurable: true,
151
+ });
152
+ }
153
+ // words that mark a posting as a board's trial or QA data, and filler that
154
+ // accompanies them ("Test Job - Do Not Apply")
155
+ const PLACEHOLDER_MARKERS = new Set([
156
+ 'test',
157
+ 'testing',
158
+ 'uat',
159
+ 'dummy',
160
+ 'sample',
161
+ 'demo',
162
+ 'placeholder',
163
+ 'ignore',
164
+ ]);
165
+ const PLACEHOLDER_FILLER = new Set([
166
+ 'do',
167
+ 'not',
168
+ 'apply',
169
+ 'please',
170
+ 'job',
171
+ 'posting',
172
+ 'position',
173
+ 'role',
174
+ 'req',
175
+ 'requisition',
176
+ 'only',
177
+ 'internal',
178
+ ]);
179
+ // standing postings that collect resumes rather than hire for a role
180
+ const OPEN_APPLICATION = /\b(?:talent (?:community|pool|network)|general (?:application|interest)|open application)\b/i;
181
+ /**
182
+ * Whether a posting stands in for a job rather than being one. The title has
183
+ * to consist of placeholder words entirely, so "Test Engineer" still counts.
184
+ */
185
+ function isPlaceholderJob(job) {
186
+ const title = typeof job?.title === 'string' ? job.title : '';
187
+ if (OPEN_APPLICATION.test(title))
188
+ return true;
189
+ const words = title.toLowerCase().match(/[a-z]+/g) ?? [];
190
+ return (words.some((word) => PLACEHOLDER_MARKERS.has(word)) &&
191
+ words.every((word) => PLACEHOLDER_MARKERS.has(word) || PLACEHOLDER_FILLER.has(word)));
192
+ }
193
+ /** Pulls listing fields out of a stringified JSON job payload, if that's what it is */
194
+ function readListingFields(content) {
195
+ if (!content.startsWith('{'))
196
+ return null;
197
+ let data;
198
+ try {
199
+ data = JSON.parse(content);
200
+ }
201
+ catch {
202
+ return null;
203
+ }
204
+ const pick = (...keys) => {
205
+ for (const key of keys) {
206
+ const value = data[key];
207
+ if (typeof value === 'string' && value)
208
+ return value;
209
+ // some boards nest the location as `{ name: 'Remote' }`
210
+ if (value && typeof value === 'object') {
211
+ const nested = value.name;
212
+ if (typeof nested === 'string' && nested)
213
+ return nested;
214
+ }
215
+ }
216
+ return undefined;
217
+ };
218
+ return {
219
+ title: pick('title', 'name', 'text'),
220
+ location: pick('location', 'locationsText', 'full_location'),
221
+ url: pick('absolute_url', 'jobUrl', 'hostedUrl', 'apply_url'),
222
+ };
223
+ }
224
+ //# sourceMappingURL=Scraper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scraper.js","sourceRoot":"","sources":["../../src/scrapers/Scraper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAuBxC,4DAA4D;AAC5D,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAEhC;IACA;IAFT,YACS,KAAa,EACb,WAAmB;QAE1B,KAAK,CAAC,WAAW,KAAK,eAAe,WAAW,GAAG,CAAC,CAAC;QAH9C,UAAK,GAAL,KAAK,CAAQ;QACb,gBAAW,GAAX,WAAW,CAAQ;QAG1B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAE/B;IACA;IAFT,YACS,WAAmB,EACnB,WAAmB,EAC1B,OAAe;QAEf,KAAK,CAAC,GAAG,WAAW,kBAAkB,WAAW,MAAM,OAAO,EAAE,CAAC,CAAC;QAJ3D,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAQ;QAI1B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAgB,OAAO;IAgDL;IA/CtB;;;;;OAKG;IACH,MAAM,CAAU,YAAY,GAAY,KAAK,CAAC;IAC9C;;;;OAIG;IACH,MAAM,CAAU,YAAY,GAAsB,EAAE,CAAC;IACrD;;;;;OAKG;IACH,MAAM,CAAU,aAAa,GAAsB,EAAE,CAAC;IAEtD;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,WAAmB;QACvC,MAAM,KAAK,GAAG,WAAW;aACtB,WAAW,EAAE;aACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;aAC3B,IAAI,EAAE;aACN,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,OAAO,CAAC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AAI,CAAC,GAAG,CAAC,CAAC;YACxB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;YACrD,wDAAwD;YACxD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACvC,MAAM,MAAM,GAAI,KAAiC,CAAC,IAAI,CAAC;gBACvD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM;oBAAE,OAAO,MAAM,CAAC;YAC1D,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;QACpC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,eAAe,EAAE,eAAe,CAAC;QAC5D,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC;KAC9D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Scraper, type ListedJob, type ParsedUrl } from './Scraper.ts';
2
+ export default class ShopifyScraper extends Scraper {
3
+ static parseUrl(url: URL): ParsedUrl | null;
4
+ jobUrl(id: string): string;
5
+ /**
6
+ * The data returned by fetching a single job by ID doesn't include
7
+ * the full job info (e.g. it has the job description but not the
8
+ * location), but when we fetch all the jobs, we do have access to
9
+ * the missing info (but not the description). So we cache this info
10
+ * to supplement the individual job when it's fetched
11
+ */
12
+ private jobPostingsById;
13
+ getJobsList(testing?: boolean): Promise<ListedJob[]>;
14
+ getJobContent(id: string): Promise<string>;
15
+ }
16
+ //# sourceMappingURL=ShopifyScraper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShopifyScraper.d.ts","sourceRoot":"","sources":["../../src/scrapers/ShopifyScraper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AA4BvE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAO3C,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAI1B;;;;;;OAMG;IACH,OAAO,CAAC,eAAe,CAA8C;IAE/D,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAmDlD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAmBjD"}
@@ -0,0 +1,104 @@
1
+ import { cachedFetch } from "../cache.js";
2
+ import { time } from "../utils/misc.js";
3
+ import { Scraper } from "./Scraper.js";
4
+ const BASE_URL = 'https://www.shopify.com';
5
+ // Shopify careers uses React Router 7 SSR with turbo-stream encoding.
6
+ // All job data is embedded in a single streamController.enqueue() call as a
7
+ // flat reference array. Strings, numbers, and objects are stored by index,
8
+ // with encoded objects using {"_K": V} where K is the key's index in the array
9
+ // and V is the value's index (or -5 for null).
10
+ function parseTurboStreamArray(html) {
11
+ const match = html.match(/streamController\.enqueue\("((?:[^"\\]|\\.)*)"\)/);
12
+ if (!match)
13
+ throw new Error('Could not find turbo-stream data in page');
14
+ return JSON.parse(JSON.parse('"' + match[1] + '"'));
15
+ }
16
+ function decodeStreamObj(arr, obj) {
17
+ const result = {};
18
+ for (const [kStr, vIdx] of Object.entries(obj)) {
19
+ const key = arr[parseInt(kStr.slice(1))];
20
+ if (typeof key !== 'string')
21
+ continue;
22
+ result[key] = vIdx === -5 ? null : arr[vIdx];
23
+ }
24
+ return result;
25
+ }
26
+ export default class ShopifyScraper extends Scraper {
27
+ static parseUrl(url) {
28
+ if (url.hostname !== 'www.shopify.com')
29
+ return null;
30
+ const match = url.pathname.match(/^\/careers\/?(?:[^/]*_)?([^/_]*)/);
31
+ if (!match)
32
+ return null;
33
+ return { slug: 'shopify', jobId: match[1] || null };
34
+ }
35
+ jobUrl(id) {
36
+ return `${BASE_URL}/careers/x_${id}`;
37
+ }
38
+ /**
39
+ * The data returned by fetching a single job by ID doesn't include
40
+ * the full job info (e.g. it has the job description but not the
41
+ * location), but when we fetch all the jobs, we do have access to
42
+ * the missing info (but not the description). So we cache this info
43
+ * to supplement the individual job when it's fetched
44
+ */
45
+ jobPostingsById = new Map();
46
+ async getJobsList(testing = false) {
47
+ const html = await cachedFetch
48
+ .call({ cache: !testing, cacheTTL: time.day }, `${BASE_URL}/careers`)
49
+ .then((r) => r.text());
50
+ const arr = parseTurboStreamArray(html);
51
+ const jpwjIdx = arr.findIndex((v) => v === 'jobPostingsWithJobs');
52
+ if (jpwjIdx === -1)
53
+ throw new Error('Could not find jobPostingsWithJobs in page data');
54
+ const jobIndices = arr[jpwjIdx + 1];
55
+ const limit = testing ? 1 : jobIndices.length;
56
+ const jobs = [];
57
+ for (let i = 0; i < limit; i++) {
58
+ const jobEntry = arr[jobIndices[i]];
59
+ // Find the jobPosting field within the entry
60
+ let jpIdx = -1;
61
+ for (const [kStr, vIdx] of Object.entries(jobEntry)) {
62
+ if (arr[parseInt(kStr.slice(1))] === 'jobPosting') {
63
+ jpIdx = vIdx;
64
+ break;
65
+ }
66
+ }
67
+ if (jpIdx === -1)
68
+ continue;
69
+ const jp = decodeStreamObj(arr, arr[jpIdx]);
70
+ const locationName = jp.locationName;
71
+ const workplaceType = jp.workplaceType;
72
+ const id = jp.id;
73
+ const location = [workplaceType, locationName]
74
+ .filter(Boolean)
75
+ .join(' - ');
76
+ this.jobPostingsById.set(id, { ...jp, location });
77
+ jobs.push({
78
+ id,
79
+ url: `${BASE_URL}/careers/x_${jp.id}`,
80
+ title: jp.title,
81
+ location,
82
+ });
83
+ }
84
+ return jobs;
85
+ }
86
+ async getJobContent(id) {
87
+ const jobPosting = await this.fromJobsList(this.jobPostingsById, id);
88
+ const html = await cachedFetch
89
+ .call({ cacheTTL: time.day }, `${BASE_URL}/careers/x_${id}`)
90
+ .then((r) => r.text());
91
+ const arr = parseTurboStreamArray(html);
92
+ // In the flat array, jobPosting fields appear in order: id, title, descriptionPlain, ...
93
+ const descIdx = arr.findIndex((v) => v === 'descriptionPlain');
94
+ if (descIdx === -1)
95
+ throw new Error(`Could not find description for job ${id}`);
96
+ return JSON.stringify({
97
+ ...jobPosting,
98
+ id,
99
+ title: arr[descIdx - 1],
100
+ descriptionPlain: arr[descIdx + 1],
101
+ });
102
+ }
103
+ }
104
+ //# sourceMappingURL=ShopifyScraper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShopifyScraper.js","sourceRoot":"","sources":["../../src/scrapers/ShopifyScraper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAkC,MAAM,cAAc,CAAC;AAEvE,MAAM,QAAQ,GAAG,yBAAyB,CAAC;AAE3C,sEAAsE;AACtE,4EAA4E;AAC5E,2EAA2E;AAC3E,+EAA+E;AAC/E,+CAA+C;AAC/C,SAAS,qBAAqB,CAAC,IAAY;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAC7E,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACxE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAU,CAAC;AAC/D,CAAC;AAED,SAAS,eAAe,CACtB,GAAU,EACV,GAA2B;IAE3B,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAuB,EAAE,CAAC;QACrE,MAAM,GAAG,GAAG,GAAG,CAAC,QAA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 import { Scraper, type ListedJob, type ParsedUrl } from './Scraper.ts';
2
+ export default class SmartRecruitersScraper extends Scraper {
3
+ private baseUrl;
4
+ static readonly discoverable = true;
5
+ static readonly boardDomains: string[];
6
+ static slugCandidates(companyName: string): string[];
7
+ static parseUrl(url: URL): ParsedUrl | null;
8
+ jobUrl(id: string): string;
9
+ constructor(...args: ConstructorParameters<typeof Scraper>);
10
+ getJobsList(testing?: boolean): Promise<ListedJob[]>;
11
+ getJobContent(id: string): Promise<string>;
12
+ }
13
+ //# sourceMappingURL=SmartRecruitersScraper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartRecruitersScraper.d.ts","sourceRoot":"","sources":["../../src/scrapers/SmartRecruitersScraper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAsBvE,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,OAAO;IACzD,OAAO,CAAC,OAAO,CAAS;IAExB,MAAM,CAAC,QAAQ,CAAC,YAAY,QAAQ;IACpC,MAAM,CAAC,QAAQ,CAAC,YAAY,WAAgC;IAI5D,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE;IAgBpD,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAQ3C,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;gBAId,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,OAAO,CAAC;IAKpD,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAyBlD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CASjD"}
@@ -0,0 +1,66 @@
1
+ import { cachedFetch } from "../cache.js";
2
+ import { time } from "../utils/misc.js";
3
+ import { Scraper } from "./Scraper.js";
4
+ export default class SmartRecruitersScraper extends Scraper {
5
+ baseUrl;
6
+ static discoverable = true;
7
+ static boardDomains = ['jobs.smartrecruiters.com'];
8
+ // SmartRecruiters slugs are PascalCase with no separators, so the shared
9
+ // lowercase candidates never match
10
+ static slugCandidates(companyName) {
11
+ const words = companyName
12
+ .replace(/[^a-zA-Z0-9]+/g, ' ')
13
+ .trim()
14
+ .split(' ')
15
+ .filter(Boolean);
16
+ if (words.length === 0)
17
+ return [];
18
+ return [
19
+ ...new Set([
20
+ words.map((w) => w[0].toUpperCase() + w.slice(1)).join(''),
21
+ words.join(''),
22
+ ]),
23
+ ];
24
+ }
25
+ static parseUrl(url) {
26
+ if (!/(^|\.)smartrecruiters\.com$/.test(url.hostname))
27
+ return null;
28
+ const [slug, id] = url.pathname.split('/').filter(Boolean);
29
+ if (!slug)
30
+ return null;
31
+ return { slug, jobId: id ?? null };
32
+ }
33
+ jobUrl(id) {
34
+ return `https://jobs.smartrecruiters.com/${this.companySlug}/${id}`;
35
+ }
36
+ constructor(...args) {
37
+ super(...args);
38
+ this.baseUrl = `https://api.smartrecruiters.com/v1/companies/${this.companySlug}/postings`;
39
+ }
40
+ async getJobsList(testing = false) {
41
+ const postings = [];
42
+ let offset = 0;
43
+ while (true) {
44
+ const res = (await cachedFetch
45
+ .call({ cache: !testing, cacheTTL: time.day }, `${this.baseUrl}?offset=${offset}`)
46
+ .then((r) => r.json()));
47
+ postings.push(...res.content);
48
+ if (testing || postings.length >= res.totalFound)
49
+ break;
50
+ offset += res.limit;
51
+ }
52
+ return postings.map((posting) => ({
53
+ id: posting.id,
54
+ url: `https://jobs.smartrecruiters.com/${this.companySlug}/${posting.id}`,
55
+ title: posting.name,
56
+ location: posting.location.fullLocation,
57
+ }));
58
+ }
59
+ async getJobContent(id) {
60
+ const res = (await cachedFetch(`${this.baseUrl}/${id}`).then((res) => res.json()));
61
+ // `location` is a structured object here, not the plain string
62
+ // `readListingFields` looks for
63
+ return JSON.stringify({ ...res, location: res.location.fullLocation });
64
+ }
65
+ }
66
+ //# sourceMappingURL=SmartRecruitersScraper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartRecruitersScraper.js","sourceRoot":"","sources":["../../src/scrapers/SmartRecruitersScraper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAkC,MAAM,cAAc,CAAC;AAsBvE,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,OAAO;IACjD,OAAO,CAAS;IAExB,MAAM,CAAU,YAAY,GAAG,IAAI,CAAC;IACpC,MAAM,CAAU,YAAY,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAE5D,yEAAyE;IACzE,mCAAmC;IACnC,MAAM,CAAC,cAAc,CAAC,WAAmB;QACvC,MAAM,KAAK,GAAG,WAAW;aACtB,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;aAC9B,IAAI,EAAE;aACN,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,OAAO,CAAC,CAAC;QAEnB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAClC,OAAO;YACL,GAAG,IAAI,GAAG,CAAC;gBACT,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1D,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;aACf,CAAC;SACH,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,GAAQ;QACtB,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,OAAO,IAAI,CAAC;QAEnE,MAAM,CAAC,IAAI,EAAE,E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AAG,EAAE,oCAAoC,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,EAAE,EAAE;YACzE,KAAK,EAAE,OAAO,CAAC,IAAI;YACnB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY;SACxC,CAAC,CAAC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAC5B,MAAM,GAAG,GAAG,CAAC,MAAM,WAAW,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CACnE,GAAG,CAAC,IAAI,EAAE,CACX,CAA2B,CAAC;QAE7B,+DAA+D;QAC/D,gCAAgC;QAChC,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IACzE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Scraper, type ListedJob, type ParsedUrl } from './Scraper.ts';
2
+ export default class UberScraper extends Scraper {
3
+ static parseUrl(url: URL): ParsedUrl | null;
4
+ jobUrl(id: string): string;
5
+ /**
6
+ * The per-job detail endpoint doesn't include the location, so we cache
7
+ * the listing fields when we have them (from `getJobsList`) and attach
8
+ * them to the individual job when it's fetched.
9
+ */
10
+ private jobsById;
11
+ getJobsList(testing?: boolean): Promise<ListedJob[]>;
12
+ getJobContent(id: string): Promise<string>;
13
+ }
14
+ //# sourceMappingURL=UberScraper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UberScraper.d.ts","sourceRoot":"","sources":["../../src/scrapers/UberScraper.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,OAAO,EACP,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AA0CtB,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAO3C,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAI1B;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAgC;IAE1C,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IA2ClD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA6BjD"}