cobalt/src/modules/processing/servicesPatternTesters.js

50 lines
1.5 KiB
JavaScript
Raw Normal View History

2022-09-01 15:51:18 +02:00
export const testers = {
2023-11-23 17:18:49 +01:00
"bilibili": (patternMatch) =>
patternMatch.id?.length <= 12,
2023-11-23 17:18:49 +01:00
"instagram": (patternMatch) =>
patternMatch.postId?.length <= 12
|| (patternMatch.username?.length <= 30 && patternMatch.storyId?.length <= 24),
2023-11-23 17:18:49 +01:00
"pinterest": (patternMatch) =>
patternMatch.id?.length <= 128,
2023-11-23 17:18:49 +01:00
"reddit": (patternMatch) =>
patternMatch.sub?.length <= 22 && patternMatch.id?.length <= 10,
2023-11-23 17:18:49 +01:00
"rutube": (patternMatch) =>
patternMatch.id?.length === 32,
2023-11-23 17:18:49 +01:00
"soundcloud": (patternMatch) =>
(patternMatch.author?.length <= 128 && patternMatch.song?.length <= 255)
2023-11-23 17:18:49 +01:00
|| patternMatch.shortLink?.length <= 32,
2023-11-23 17:18:49 +01:00
"streamable": (patternMatch) =>
patternMatch.id?.length === 6,
"tiktok": (patternMatch) =>
patternMatch.postId?.length <= 21 || patternMatch.id?.length <= 13,
2023-11-23 17:18:49 +01:00
"tumblr": (patternMatch) =>
patternMatch.id?.length < 21
|| (patternMatch.id?.length < 21 && patternMatch.user?.length <= 32),
2023-11-23 17:18:49 +01:00
"twitch": (patternMatch) =>
patternMatch.channel && patternMatch.clip?.length <= 100,
2023-09-16 12:27:53 +02:00
2023-11-23 17:18:49 +01:00
"twitter": (patternMatch) =>
patternMatch.id?.length < 20,
2023-04-24 21:01:25 +02:00
2023-11-23 17:18:49 +01:00
"vimeo": (patternMatch) =>
patternMatch.id?.length <= 11,
2023-09-16 12:27:53 +02:00
2023-11-23 17:18:49 +01:00
"vine": (patternMatch) =>
patternMatch.id?.length <= 12,
2023-04-29 21:33:36 +02:00
2023-11-23 17:18:49 +01:00
"vk": (patternMatch) =>
patternMatch.userId?.length <= 10 && patternMatch.videoId?.length <= 10,
2023-08-19 18:42:10 +02:00
2023-11-23 17:18:49 +01:00
"youtube": (patternMatch) =>
patternMatch.id?.length <= 11,
}