- Add authentication scripts with SubtleCrypto password encryption - Add sourcemap extraction pipeline (update-urls, download-sourcemaps, extract-sources) - Add Playwright API interception script for monetization endpoints - Document two-step auth flow with JWT tokens and dual cookies - Move extracted source from root to anyclip/ directory - Add project configuration (.env.example, .gitignore, CLAUDE.md)
79 lines
1.7 KiB
Markdown
79 lines
1.7 KiB
Markdown
# AnyClip Integration
|
|
|
|
Tools for integrating with AnyClip's Video Manager API.
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
# Edit .env with your AnyClip credentials
|
|
bun install
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
├── anyclip/ # Extracted source code (from sourcemaps)
|
|
├── docs/ # Documentation
|
|
├── scripts/ # CLI tools
|
|
├── sourcemaps/ # Raw .map files (gitignored)
|
|
└── urls.txt # JS file URLs to download
|
|
```
|
|
|
|
## Scripts
|
|
|
|
### Authentication
|
|
|
|
```bash
|
|
# Login and save session to session.json
|
|
bun scripts/auth.ts
|
|
```
|
|
|
|
Programmatic usage:
|
|
|
|
```typescript
|
|
import { login, getAuthHeaders } from './scripts/auth';
|
|
|
|
const session = await login(email, password);
|
|
const headers = getAuthHeaders(session);
|
|
// session.cookies contains both required cookies
|
|
```
|
|
|
|
See [docs/auth.md](docs/auth.md) for details on the two-step auth flow.
|
|
|
|
### Source Extraction
|
|
|
|
Extract AnyClip's frontend source from public sourcemaps:
|
|
|
|
```bash
|
|
# 1. Update urls.txt from build manifest
|
|
bun scripts/update-urls.ts
|
|
|
|
# 2. Download sourcemaps for all URLs
|
|
bun scripts/download-sourcemaps.ts
|
|
|
|
# 3. Extract source files to anyclip/
|
|
bun scripts/extract-sources.ts
|
|
```
|
|
|
|
Or run all three:
|
|
|
|
```bash
|
|
bun scripts/update-urls.ts && bun scripts/download-sourcemaps.ts && bun scripts/extract-sources.ts
|
|
```
|
|
|
|
### Script Options
|
|
|
|
**extract-sources.ts:**
|
|
```bash
|
|
bun scripts/extract-sources.ts [options]
|
|
--output, -o <dir> Output directory (default: anyclip)
|
|
--input, -i <dir> Sourcemaps directory (default: sourcemaps)
|
|
--verbose, -v Verbose output
|
|
--no-clean Don't delete output directory first
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- [docs/auth.md](docs/auth.md) - Authentication system (two-step flow, cookies, encryption)
|