cobalt/src/modules/processing/servicesPatternTesters.js

73 lines
2.5 KiB
JavaScript
Raw Normal View History

2022-09-01 15:51:18 +02:00
export const testers = {
"bilibili": (patternMatch) =>
patternMatch.comId?.length <= 12 || patternMatch.comShortLink?.length <= 16
|| patternMatch.tvId?.length <= 24,
"dailymotion": (patternMatch) => patternMatch.id?.length <= 32,
2023-11-23 17:18:49 +01:00
"instagram": (patternMatch) =>
patternMatch.postId?.length <= 12
|| (patternMatch.username?.length <= 30 && patternMatch.storyId?.length <= 24),
2024-05-29 09:12:52 +02:00
"loom": (patternMatch) =>
patternMatch.id?.length <= 32,
2024-01-17 08:02:52 +01:00
"ok": (patternMatch) =>
patternMatch.id?.length <= 16,
2023-11-23 17:18:49 +01:00
"pinterest": (patternMatch) =>
patternMatch.id?.length <= 128 || patternMatch.shortLink?.length <= 32,
2023-11-23 17:18:49 +01:00
"reddit": (patternMatch) =>
(patternMatch.sub?.length <= 22 && patternMatch.id?.length <= 10)
|| (patternMatch.user?.length <= 22 && patternMatch.id?.length <= 10),
2023-11-23 17:18:49 +01:00
"rutube": (patternMatch) =>
(patternMatch.id?.length === 32 && patternMatch.key?.length <= 32) ||
patternMatch.id?.length === 32 || patternMatch.yappyId?.length === 32,
2023-11-23 17:18:49 +01:00
"soundcloud": (patternMatch) =>
(patternMatch.author?.length <= 255 && patternMatch.song?.length <= 255)
2023-11-23 17:18:49 +01:00
|| patternMatch.shortLink?.length <= 32,
"snapchat": (patternMatch) =>
(patternMatch.username?.length <= 32 && (!patternMatch.storyId || patternMatch.storyId?.length <= 255))
|| patternMatch.spotlightId?.length <= 255
|| patternMatch.shortLink?.length <= 16,
2023-11-23 17:18:49 +01:00
"streamable": (patternMatch) =>
patternMatch.id?.length === 6,
2024-05-29 09:12:52 +02:00
2023-11-23 17:18:49 +01:00
"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) =>
2024-03-05 00:26:14 +01:00
patternMatch.id?.length <= 11
&& (!patternMatch.password || patternMatch.password.length < 16),
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,
"facebook": (patternMatch) =>
patternMatch.shortLink?.length <= 11
|| patternMatch.username?.length <= 30
|| patternMatch.caption?.length <= 255
|| patternMatch.id?.length <= 20,
}