Files
baoyu-skills/packages/baoyu-fetch/src/adapters/x/match.ts
T

10 lines
297 B
TypeScript

export function isXHost(hostname: string): boolean {
return ["x.com", "www.x.com", "twitter.com", "www.twitter.com"].includes(hostname);
}
export function extractStatusId(url: URL): string | undefined {
const match = url.pathname.match(/\/(?:status|article)\/(\d+)/);
return match?.[1];
}