[scraper] move is-video function to a file

This commit is contained in:
TheBeastLT
2020-03-17 19:28:43 +01:00
parent 78b3dda9e3
commit d26764fce9
2 changed files with 24 additions and 6 deletions

22
scraper/lib/video.js Normal file
View File

@@ -0,0 +1,22 @@
const EXTENSIONS = [
"3g2",
"3gp",
"avi",
"flv",
"mkv",
"mov",
"mp2",
"mp4",
"mpe",
"mpeg",
"mpg",
"mpv",
"webm",
"wmv",
"ogm"
];
module.exports = (filename) => {
const extensionMatch = filename.match(/\.(\w{2,4})$/);
return extensionMatch && EXTENSIONS.includes(extensionMatch[1].toLowerCase());
};