api: add support for bluesky videos & clean up service patterns

This commit is contained in:
wukko
2024-09-01 14:34:44 +06:00
parent 4478a963c5
commit 6c9601690b
4 changed files with 121 additions and 53 deletions

View File

@@ -1,73 +1,76 @@
export const testers = {
"bilibili": (patternMatch) =>
patternMatch.comId?.length <= 12 || patternMatch.comShortLink?.length <= 16
|| patternMatch.tvId?.length <= 24,
"bilibili": pattern =>
pattern.comId?.length <= 12 || pattern.comShortLink?.length <= 16
|| pattern.tvId?.length <= 24,
"dailymotion": (patternMatch) => patternMatch.id?.length <= 32,
"dailymotion": pattern => pattern.id?.length <= 32,
"instagram": (patternMatch) =>
patternMatch.postId?.length <= 12
|| (patternMatch.username?.length <= 30 && patternMatch.storyId?.length <= 24),
"instagram": pattern =>
pattern.postId?.length <= 12
|| (pattern.username?.length <= 30 && pattern.storyId?.length <= 24),
"loom": (patternMatch) =>
patternMatch.id?.length <= 32,
"loom": pattern =>
pattern.id?.length <= 32,
"ok": (patternMatch) =>
patternMatch.id?.length <= 16,
"ok": pattern =>
pattern.id?.length <= 16,
"pinterest": (patternMatch) =>
patternMatch.id?.length <= 128 || patternMatch.shortLink?.length <= 32,
"pinterest": pattern =>
pattern.id?.length <= 128 || pattern.shortLink?.length <= 32,
"reddit": (patternMatch) =>
(patternMatch.sub?.length <= 22 && patternMatch.id?.length <= 10)
|| (patternMatch.user?.length <= 22 && patternMatch.id?.length <= 10),
"reddit": pattern =>
(pattern.sub?.length <= 22 && pattern.id?.length <= 10)
|| (pattern.user?.length <= 22 && pattern.id?.length <= 10),
"rutube": (patternMatch) =>
(patternMatch.id?.length === 32 && patternMatch.key?.length <= 32) ||
patternMatch.id?.length === 32 || patternMatch.yappyId?.length === 32,
"rutube": pattern =>
(pattern.id?.length === 32 && pattern.key?.length <= 32) ||
pattern.id?.length === 32 || pattern.yappyId?.length === 32,
"soundcloud": (patternMatch) =>
(patternMatch.author?.length <= 255 && patternMatch.song?.length <= 255)
|| patternMatch.shortLink?.length <= 32,
"soundcloud": pattern =>
(pattern.author?.length <= 255 && pattern.song?.length <= 255)
|| pattern.shortLink?.length <= 32,
"snapchat": (patternMatch) =>
(patternMatch.username?.length <= 32 && (!patternMatch.storyId || patternMatch.storyId?.length <= 255))
|| patternMatch.spotlightId?.length <= 255
|| patternMatch.shortLink?.length <= 16,
"snapchat": pattern =>
(pattern.username?.length <= 32 && (!pattern.storyId || pattern.storyId?.length <= 255))
|| pattern.spotlightId?.length <= 255
|| pattern.shortLink?.length <= 16,
"streamable": (patternMatch) =>
patternMatch.id?.length === 6,
"streamable": pattern =>
pattern.id?.length === 6,
"tiktok": (patternMatch) =>
patternMatch.postId?.length <= 21 || patternMatch.id?.length <= 13,
"tiktok": pattern =>
pattern.postId?.length <= 21 || pattern.id?.length <= 13,
"tumblr": (patternMatch) =>
patternMatch.id?.length < 21
|| (patternMatch.id?.length < 21 && patternMatch.user?.length <= 32),
"tumblr": pattern =>
pattern.id?.length < 21
|| (pattern.id?.length < 21 && pattern.user?.length <= 32),
"twitch": (patternMatch) =>
patternMatch.channel && patternMatch.clip?.length <= 100,
"twitch": pattern =>
pattern.channel && pattern.clip?.length <= 100,
"twitter": (patternMatch) =>
patternMatch.id?.length < 20,
"twitter": pattern =>
pattern.id?.length < 20,
"vimeo": (patternMatch) =>
patternMatch.id?.length <= 11
&& (!patternMatch.password || patternMatch.password.length < 16),
"vimeo": pattern =>
pattern.id?.length <= 11
&& (!pattern.password || pattern.password.length < 16),
"vine": (patternMatch) =>
patternMatch.id?.length <= 12,
"vine": pattern =>
pattern.id?.length <= 12,
"vk": (patternMatch) =>
patternMatch.userId?.length <= 10 && patternMatch.videoId?.length <= 10,
"vk": pattern =>
pattern.userId?.length <= 10 && pattern.videoId?.length <= 10,
"youtube": (patternMatch) =>
patternMatch.id?.length <= 11,
"youtube": pattern =>
pattern.id?.length <= 11,
"facebook": (patternMatch) =>
patternMatch.shortLink?.length <= 11
|| patternMatch.username?.length <= 30
|| patternMatch.caption?.length <= 255
|| patternMatch.id?.length <= 20 && !patternMatch.shareType
|| patternMatch.id?.length <= 20 && patternMatch.shareType?.length === 1,
"facebook": pattern =>
pattern.shortLink?.length <= 11
|| pattern.username?.length <= 30
|| pattern.caption?.length <= 255
|| pattern.id?.length <= 20 && !pattern.shareType
|| pattern.id?.length <= 20 && pattern.shareType?.length === 1,
"bsky": pattern =>
pattern.user?.length <= 128 && pattern.post?.length <= 128,
}