feat(psf): transition to Order 2 (Sovereign Architect) with advanced skill graph and philosophical alignment
This commit is contained in:
40
projects/org-skill-web-research/src/browse.js
Normal file
40
projects/org-skill-web-research/src/browse.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const { firefox } = require('playwright');
|
||||
const fs = require('fs');
|
||||
|
||||
async function browse(url) {
|
||||
const browser = await firefox.launch({ headless: true });
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
||||
try {
|
||||
await page.goto(url, { waitUntil: 'networkidle', timeout: 30000 });
|
||||
|
||||
// Wait a bit for JS to render
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
const screenshot = await page.screenshot({ type: 'jpeg', quality: 80 });
|
||||
const text = await page.innerText('body');
|
||||
const title = await page.title();
|
||||
|
||||
const result = {
|
||||
title: title,
|
||||
text: text.substring(0, 5000), // Limit text to 5k chars
|
||||
screenshot: screenshot.toString('base64')
|
||||
};
|
||||
|
||||
console.log(JSON.stringify(result));
|
||||
} catch (error) {
|
||||
console.error(JSON.stringify({ error: error.message }));
|
||||
process.exit(1);
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
|
||||
const url = process.argv[2];
|
||||
if (!url) {
|
||||
console.error("No URL provided");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
browse(url);
|
||||
Reference in New Issue
Block a user