SPB Git forge
7commits 1branches 0releases
229.0 KBsize
maindefault branch
12 days agolast push
TypeScript 91.8% HTML 3.2% JavaScript 3% SQL 1.4% CSS 0.7%
1.5 KB · 14 lines javascript
Raw Blame History
1import { chromium } from "playwright";2const BASE = process.env.BASE ?? "https://www.socialcrawl.co";3const CODE = process.env.CODE;4const b = await chromium.launch(); const p = await b.newPage({ viewport: { width: 1500, height: 1000 } });5await p.goto(`${BASE}/access`); await p.fill('input[name=passcode]', CODE); await p.click("button"); await p.waitForURL(`${BASE}/`);6const job = await p.evaluate(async () => { const r = await fetch("/api/jobs", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ platform: "youtube", mode: "topic", query: "intelligence artificielle Québec", goal: "Discover public Quebec creators and channels discussing artificial intelligence", minutes: 2, actions: 8, media: 1, headless: true }) }); return { status: r.status, body: await r.text() }; });7console.log("launch:", JSON.stringify(job));8await p.goto(`${BASE}/jobs`); await p.waitForTimeout(25000); await p.screenshot({ path: "/tmp/pub-jobs.png" });9await p.goto(`${BASE}/`); await p.waitForTimeout(12000); await p.screenshot({ path: "/tmp/pub-home.png", fullPage: false });10const sessions = await p.evaluate(async () => (await (await fetch("/api/sessions?limit=1")).json()));11const sid = sessions[0]?.session_id; console.log("session:", sid, sessions[0]?.goal);12if (sid) { await p.goto(`${BASE}/sessions/${sid}`); await p.waitForTimeout(6000); await p.screenshot({ path: "/tmp/pub-session.png", fullPage: true }); await p.click("text=events"); await p.waitForTimeout(6000); await p.screenshot({ path: "/tmp/pub-events.png" }); }13await b.close();14