mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-21 17:59:47 +08:00
feat(baoyu-fetch): add URL reader CLI with Chrome CDP and site adapters
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
export function normalizeUrl(input: string): URL {
|
||||
try {
|
||||
return new URL(input);
|
||||
} catch {
|
||||
throw new Error(`Invalid URL: ${input}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function sanitizeFilename(input: string): string {
|
||||
return input.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "document";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user