mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-26 03:31:24 +08:00
Co-authored-by: icarus <eurfelux@gmail.com> Co-authored-by: eeee0717 <chentao020717@outlook.com>
14 lines
374 B
TypeScript
14 lines
374 B
TypeScript
export const DEFAULT_DOCUMENT_COUNT = 6
|
|
export const DEFAULT_RELEVANT_SCORE = 0
|
|
export type UrlSource = 'normal' | 'github' | 'youtube'
|
|
|
|
const youtubeRegex = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be|youtube\.be|yt\.be)/i
|
|
|
|
export function getUrlSource(url: string): UrlSource {
|
|
if (youtubeRegex.test(url)) {
|
|
return 'youtube'
|
|
} else {
|
|
return 'normal'
|
|
}
|
|
}
|