commit c35299bf8cda809da04d10e1a8f02bc8898523af Author: abearxiong Date: Thu Dec 25 12:15:52 2025 +0800 temp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/bun.lock b/bun.lock new file mode 100644 index 0000000..3f9b619 --- /dev/null +++ b/bun.lock @@ -0,0 +1,19 @@ +{ + "lockfileVersion": 1, + "configVersion": 1, + "workspaces": { + "": { + "name": "xhs-helper", + "dependencies": { + "playwright": "^1.57.0", + }, + }, + }, + "packages": { + "fsevents": ["fsevents@2.3.2", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="], + + "playwright": ["playwright@1.57.0", "", { "dependencies": { "playwright-core": "1.57.0" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-ilYQj1s8sr2ppEJ2YVadYBN0Mb3mdo9J0wQ+UuDhzYqURwSoW4n1Xs5vs7ORwgDGmyEh33tRMeS8KhdkMoLXQw=="], + + "playwright-core": ["playwright-core@1.57.0", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-agTcKlMw/mjBWOnD6kFZttAAGHgi/Nw0CZ2o6JqWSbMlI219lAFLZZCyqByTsvVAJq5XA5H8cA6PrvBRpBWEuQ=="], + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..a56c488 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "xhs-helper", + "version": "0.0.1", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "abearxiong (https://www.xiongxiao.me)", + "license": "MIT", + "packageManager": "pnpm@10.26.0", + "type": "module", + "dependencies": { + "playwright": "^1.57.0" + } +} diff --git a/src/playwright/index.ts b/src/playwright/index.ts new file mode 100644 index 0000000..f885708 --- /dev/null +++ b/src/playwright/index.ts @@ -0,0 +1,11 @@ +import { chromium } from 'playwright'; + +export const main = async () => { + const browser = await chromium.launch({ headless: true }); + const page = await browser.newPage(); + await page.goto('https://www.xiaohongshu.com'); + console.log(await page.title()); + await browser.close(); +} + +main(); \ No newline at end of file