Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 1s
Monorepo Pipeline / 🧹 Lint (push) Failing after 35s
Monorepo Pipeline / 🧪 Test (push) Failing after 35s
Monorepo Pipeline / 🏗️ Build (push) Failing after 12s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Image Processor (push) Has been skipped
Monorepo Pipeline / 🐳 Build Directus (Base) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { config } from "dotenv";
|
|
import * as path from "node:path";
|
|
|
|
config({ path: path.resolve(process.cwd(), "../../.env") });
|
|
|
|
const login = process.env.DATA_FOR_SEO_LOGIN || "";
|
|
const password = process.env.DATA_FOR_SEO_PASSWORD || "";
|
|
const BASE = "https://api.dataforseo.com/v3";
|
|
const auth = Buffer.from(`${login}:${password}`).toString("base64");
|
|
const headers: Record<string, string> = { Authorization: `Basic ${auth}`, "Content-Type": "application/json" };
|
|
|
|
async function apiPost(path: string, body: any) {
|
|
const r = await fetch(`${BASE}${path}`, { method: "POST", headers, body: JSON.stringify(body) });
|
|
return r.json();
|
|
}
|
|
|
|
async function run() {
|
|
console.log("Starting test crawl with enable_browser_rendering = true...");
|
|
const req = await apiPost("/on_page/task_post", [{
|
|
target: "e-tib.com",
|
|
max_crawl_pages: 1,
|
|
load_resources: true,
|
|
enable_javascript: true,
|
|
enable_browser_rendering: true,
|
|
check_spell: false,
|
|
}]);
|
|
|
|
console.log(JSON.stringify(req?.tasks?.[0] || req, null, 2));
|
|
}
|
|
|
|
run();
|