mcp-scraper 0.31.0 → 0.32.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 +1 -1
- package/dist/bin/api-server.cjs +55 -11
- package/dist/bin/api-server.cjs.map +1 -1
- package/dist/bin/api-server.js +2 -2
- package/dist/bin/mcp-scraper-cli.cjs +4 -1
- package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
- package/dist/bin/mcp-scraper-cli.js +3 -3
- package/dist/bin/mcp-scraper-install.cjs +1 -1
- package/dist/bin/mcp-scraper-install.cjs.map +1 -1
- package/dist/bin/mcp-scraper-install.js +1 -1
- package/dist/bin/mcp-stdio-server.cjs +9 -6
- package/dist/bin/mcp-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-stdio-server.js +3 -3
- package/dist/bin/paa-harvest.cjs +26 -4
- package/dist/bin/paa-harvest.cjs.map +1 -1
- package/dist/bin/paa-harvest.js +2 -2
- package/dist/{chunk-KAMKTSJQ.js → chunk-55M5CE5L.js} +2 -2
- package/dist/chunk-CPQF3PYW.js +7 -0
- package/dist/chunk-CPQF3PYW.js.map +1 -0
- package/dist/{chunk-ZQSHKWV4.js → chunk-PTHY7NYD.js} +4 -1
- package/dist/chunk-PTHY7NYD.js.map +1 -0
- package/dist/{chunk-YH5DRFWQ.js → chunk-RDCCU7CQ.js} +25 -6
- package/dist/chunk-RDCCU7CQ.js.map +1 -0
- package/dist/{chunk-ZOXL3VWO.js → chunk-YOOEAXWP.js} +8 -8
- package/dist/chunk-YOOEAXWP.js.map +1 -0
- package/dist/index.cjs +26 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +2 -2
- package/dist/{server-DS3ZSNNO.js → server-OBOTNFD6.js} +31 -8
- package/dist/{server-DS3ZSNNO.js.map → server-OBOTNFD6.js.map} +1 -1
- package/dist/{worker-RYP5EOV5.js → worker-7DJYUACV.js} +3 -3
- package/docs/mcp-tool-manifest.generated.json +7 -7
- package/package.json +1 -1
- package/dist/chunk-W3GYPHFL.js +0 -7
- package/dist/chunk-W3GYPHFL.js.map +0 -1
- package/dist/chunk-YH5DRFWQ.js.map +0 -1
- package/dist/chunk-ZOXL3VWO.js.map +0 -1
- package/dist/chunk-ZQSHKWV4.js.map +0 -1
- /package/dist/{chunk-KAMKTSJQ.js.map → chunk-55M5CE5L.js.map} +0 -0
- /package/dist/{worker-RYP5EOV5.js.map → worker-7DJYUACV.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -8,6 +8,9 @@ declare const HarvestOptionsSchema: z.ZodObject<{
|
|
|
8
8
|
device: z.ZodDefault<z.ZodEnum<["desktop", "mobile"]>>;
|
|
9
9
|
proxyMode: z.ZodDefault<z.ZodEnum<["location", "configured", "none"]>>;
|
|
10
10
|
proxyZip: z.ZodOptional<z.ZodString>;
|
|
11
|
+
keepDefaultProxy: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
requireUsEgress: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
11
14
|
debug: z.ZodDefault<z.ZodBoolean>;
|
|
12
15
|
depth: z.ZodDefault<z.ZodNumber>;
|
|
13
16
|
maxQuestions: z.ZodDefault<z.ZodNumber>;
|
|
@@ -38,6 +41,9 @@ declare const HarvestOptionsSchema: z.ZodObject<{
|
|
|
38
41
|
pages: number;
|
|
39
42
|
location?: string | undefined;
|
|
40
43
|
proxyZip?: string | undefined;
|
|
44
|
+
keepDefaultProxy?: boolean | undefined;
|
|
45
|
+
requireUsEgress?: boolean | undefined;
|
|
46
|
+
maxAttempts?: number | undefined;
|
|
41
47
|
profileDir?: string | undefined;
|
|
42
48
|
proxy?: string | undefined;
|
|
43
49
|
kernelApiKey?: string | undefined;
|
|
@@ -52,6 +58,9 @@ declare const HarvestOptionsSchema: z.ZodObject<{
|
|
|
52
58
|
device?: "desktop" | "mobile" | undefined;
|
|
53
59
|
proxyMode?: "none" | "location" | "configured" | undefined;
|
|
54
60
|
proxyZip?: string | undefined;
|
|
61
|
+
keepDefaultProxy?: boolean | undefined;
|
|
62
|
+
requireUsEgress?: boolean | undefined;
|
|
63
|
+
maxAttempts?: number | undefined;
|
|
55
64
|
debug?: boolean | undefined;
|
|
56
65
|
depth?: number | undefined;
|
|
57
66
|
maxQuestions?: number | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ declare const HarvestOptionsSchema: z.ZodObject<{
|
|
|
8
8
|
device: z.ZodDefault<z.ZodEnum<["desktop", "mobile"]>>;
|
|
9
9
|
proxyMode: z.ZodDefault<z.ZodEnum<["location", "configured", "none"]>>;
|
|
10
10
|
proxyZip: z.ZodOptional<z.ZodString>;
|
|
11
|
+
keepDefaultProxy: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
requireUsEgress: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
11
14
|
debug: z.ZodDefault<z.ZodBoolean>;
|
|
12
15
|
depth: z.ZodDefault<z.ZodNumber>;
|
|
13
16
|
maxQuestions: z.ZodDefault<z.ZodNumber>;
|
|
@@ -38,6 +41,9 @@ declare const HarvestOptionsSchema: z.ZodObject<{
|
|
|
38
41
|
pages: number;
|
|
39
42
|
location?: string | undefined;
|
|
40
43
|
proxyZip?: string | undefined;
|
|
44
|
+
keepDefaultProxy?: boolean | undefined;
|
|
45
|
+
requireUsEgress?: boolean | undefined;
|
|
46
|
+
maxAttempts?: number | undefined;
|
|
41
47
|
profileDir?: string | undefined;
|
|
42
48
|
proxy?: string | undefined;
|
|
43
49
|
kernelApiKey?: string | undefined;
|
|
@@ -52,6 +58,9 @@ declare const HarvestOptionsSchema: z.ZodObject<{
|
|
|
52
58
|
device?: "desktop" | "mobile" | undefined;
|
|
53
59
|
proxyMode?: "none" | "location" | "configured" | undefined;
|
|
54
60
|
proxyZip?: string | undefined;
|
|
61
|
+
keepDefaultProxy?: boolean | undefined;
|
|
62
|
+
requireUsEgress?: boolean | undefined;
|
|
63
|
+
maxAttempts?: number | undefined;
|
|
55
64
|
debug?: boolean | undefined;
|
|
56
65
|
depth?: number | undefined;
|
|
57
66
|
maxQuestions?: number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
harvest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RDCCU7CQ.js";
|
|
4
4
|
import {
|
|
5
5
|
recordVendorUsage
|
|
6
6
|
} from "./chunk-MTSBI7ZH.js";
|
|
7
7
|
import "./chunk-K443GQY5.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-PTHY7NYD.js";
|
|
9
9
|
import "./chunk-M2S27J6Z.js";
|
|
10
10
|
import "./chunk-ICT7DDHL.js";
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
harvest,
|
|
17
17
|
normalizeLocation,
|
|
18
18
|
resolveKernelProxyId
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RDCCU7CQ.js";
|
|
20
20
|
import {
|
|
21
21
|
HttpMcpToolExecutor,
|
|
22
22
|
assessTranscriptSignal,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
sanitizeAttempts,
|
|
37
37
|
sanitizeHarvestResult,
|
|
38
38
|
transcribeMediaUrl
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-YOOEAXWP.js";
|
|
40
40
|
import {
|
|
41
41
|
auditImages,
|
|
42
42
|
buildLinkReport,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
workflowOutputBaseDir,
|
|
66
66
|
workflowStepCount,
|
|
67
67
|
workflowSupportsSteps
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-55M5CE5L.js";
|
|
69
69
|
import "./chunk-K443GQY5.js";
|
|
70
70
|
import {
|
|
71
71
|
DEFAULT_MAPS_PROXY_MODE,
|
|
@@ -76,8 +76,8 @@ import {
|
|
|
76
76
|
RawMapsHoursRowSchema,
|
|
77
77
|
RawMapsOverviewSchema,
|
|
78
78
|
RawMapsReviewStatsSchema
|
|
79
|
-
} from "./chunk-
|
|
80
|
-
import "./chunk-
|
|
79
|
+
} from "./chunk-PTHY7NYD.js";
|
|
80
|
+
import "./chunk-CPQF3PYW.js";
|
|
81
81
|
import {
|
|
82
82
|
completeExtractJob,
|
|
83
83
|
countSuccessfulPages,
|
|
@@ -129,6 +129,7 @@ import {
|
|
|
129
129
|
} from "./chunk-4767BA2O.js";
|
|
130
130
|
import {
|
|
131
131
|
CaptchaError,
|
|
132
|
+
ExtractionError,
|
|
132
133
|
RECAPTCHA_INSTRUCTIONS,
|
|
133
134
|
sanitizeVendorName
|
|
134
135
|
} from "./chunk-M2S27J6Z.js";
|
|
@@ -13088,6 +13089,12 @@ function buildGoogleLocalResultsUrl(input) {
|
|
|
13088
13089
|
if (input.location) params.set("uule", encodeUule(normalizeLocation(input.location)));
|
|
13089
13090
|
return `https://www.google.com/search?${params.toString()}`;
|
|
13090
13091
|
}
|
|
13092
|
+
function buildGoogleOrganicSearchUrl(input) {
|
|
13093
|
+
const query = [input.query, input.location].filter(Boolean).join(" ");
|
|
13094
|
+
const params = new URLSearchParams({ q: query, gl: input.gl, hl: input.hl, pws: "0" });
|
|
13095
|
+
if (input.location) params.set("uule", encodeUule(normalizeLocation(input.location)));
|
|
13096
|
+
return `https://www.google.com/search?${params.toString()}`;
|
|
13097
|
+
}
|
|
13091
13098
|
var MapsSearchExtractor = class {
|
|
13092
13099
|
constructor(driver) {
|
|
13093
13100
|
this.driver = driver;
|
|
@@ -13096,13 +13103,14 @@ var MapsSearchExtractor = class {
|
|
|
13096
13103
|
async extract(options) {
|
|
13097
13104
|
const startMs = Date.now();
|
|
13098
13105
|
const searchQuery = [options.query, options.location].filter(Boolean).join(" ");
|
|
13099
|
-
const searchUrl =
|
|
13106
|
+
const searchUrl = buildGoogleOrganicSearchUrl(options);
|
|
13100
13107
|
const config = {
|
|
13101
13108
|
headless: options.headless,
|
|
13102
13109
|
kernelApiKey: options.kernelApiKey,
|
|
13103
13110
|
kernelProxyId: options.kernelProxyId,
|
|
13104
13111
|
kernelProxyResolution: options.kernelProxyResolution,
|
|
13105
13112
|
proxyMode: options.proxyMode,
|
|
13113
|
+
keepDefaultProxy: options.proxyMode !== "location" && options.proxyMode !== "configured" && !options.kernelProxyId,
|
|
13106
13114
|
viewport: { width: 1280, height: 900 },
|
|
13107
13115
|
locale: `${options.hl}-${options.gl.toUpperCase()}`,
|
|
13108
13116
|
debug: options.debug
|
|
@@ -13113,6 +13121,10 @@ var MapsSearchExtractor = class {
|
|
|
13113
13121
|
await page.goto(searchUrl, { waitUntil: "domcontentloaded", timeout: 6e4 });
|
|
13114
13122
|
await page.waitForTimeout(LOCAL_RESULTS_WAIT_MS);
|
|
13115
13123
|
if (await this.detectBlock(page)) throw new CaptchaError(RECAPTCHA_INSTRUCTIONS);
|
|
13124
|
+
const reachedFinder = await this.clickIntoLocalFinder(page);
|
|
13125
|
+
if (!reachedFinder) throw new ExtractionError('Google "More businesses" control was not found on the organic results page');
|
|
13126
|
+
await page.waitForTimeout(LOCAL_RESULTS_WAIT_MS);
|
|
13127
|
+
if (await this.detectBlock(page)) throw new CaptchaError(RECAPTCHA_INSTRUCTIONS);
|
|
13116
13128
|
const results = await this.collectResults(page, options);
|
|
13117
13129
|
return {
|
|
13118
13130
|
query: options.query,
|
|
@@ -13129,6 +13141,17 @@ var MapsSearchExtractor = class {
|
|
|
13129
13141
|
await this.driver.close();
|
|
13130
13142
|
}
|
|
13131
13143
|
}
|
|
13144
|
+
async clickIntoLocalFinder(page) {
|
|
13145
|
+
const control = page.getByRole("link", { name: /more (businesses|places|results)/i }).or(page.getByRole("button", { name: /more (businesses|places|results)/i })).first();
|
|
13146
|
+
const visible = await control.isVisible({ timeout: 1e4 }).catch(() => false);
|
|
13147
|
+
if (!visible) return false;
|
|
13148
|
+
await control.click({ timeout: 1e4 }).catch(() => {
|
|
13149
|
+
});
|
|
13150
|
+
await page.waitForTimeout(5e3);
|
|
13151
|
+
return page.evaluate(
|
|
13152
|
+
() => /[?&]udm=1/.test(location.href) || document.querySelectorAll('a[href*="/maps/place/"]').length > 0
|
|
13153
|
+
);
|
|
13154
|
+
}
|
|
13132
13155
|
async detectBlock(page) {
|
|
13133
13156
|
return page.evaluate(() => {
|
|
13134
13157
|
const text2 = document.body.innerText.slice(0, 2e3);
|
|
@@ -27382,7 +27405,7 @@ app.get("/cron/tick", async (c) => {
|
|
|
27382
27405
|
if (!process.env.CRON_SECRET || secret2 !== `Bearer ${process.env.CRON_SECRET}`) {
|
|
27383
27406
|
return c.json({ error: "Unauthorized" }, 401);
|
|
27384
27407
|
}
|
|
27385
|
-
const { drainQueue } = await import("./worker-
|
|
27408
|
+
const { drainQueue } = await import("./worker-7DJYUACV.js");
|
|
27386
27409
|
const budget = { maxJobs: 10, deadlineMs: Date.now() + 28e4 };
|
|
27387
27410
|
const workflowDispatchResult = await dispatchDueWorkflowSchedules(`${new URL(c.req.url).protocol}//${new URL(c.req.url).host}`);
|
|
27388
27411
|
const [results, sweepResult, reapResult, expiredResult, blobCleanup, connectedDataArtifactCleanup] = await Promise.all([
|
|
@@ -27585,4 +27608,4 @@ app.get("/blog/:slug/", (c) => {
|
|
|
27585
27608
|
export {
|
|
27586
27609
|
app
|
|
27587
27610
|
};
|
|
27588
|
-
//# sourceMappingURL=server-
|
|
27611
|
+
//# sourceMappingURL=server-OBOTNFD6.js.map
|