wip(niconico): service added

This commit is contained in:
mikhail 2024-05-20 21:59:33 +05:00
parent b1ed1f5199
commit c1219654fd
4 changed files with 18 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import streamable from "./services/streamable.js";
import twitch from "./services/twitch.js";
import rutube from "./services/rutube.js";
import dailymotion from "./services/dailymotion.js";
import nicovideo from "./services/nicovideo.js";
let freebind;
@ -185,6 +186,9 @@ export default async function(host, patternMatch, lang, obj) {
case "dailymotion":
r = await dailymotion(patternMatch);
break;
case "nicovideo":
r = await nicovideo({ id: patternMatch.id });
break;
default:
return createResponse("error", {
t: loc(lang, 'ErrorUnsupported')

View File

@ -0,0 +1,4 @@
// TODO @synzr implement nicovideo
export default function nicovideo() {
return { error: "ErrorEmptyDownload" };
}

View File

@ -110,6 +110,12 @@
"alias": "dailymotion videos",
"patterns": ["video/:id"],
"enabled": true
},
"nicovideo": {
"alias": "niconico videos",
"tld": "jp",
"patterns": ["watch/:id"],
"enabled": true
}
}
}

View File

@ -54,4 +54,8 @@ export const testers = {
"youtube": (patternMatch) =>
patternMatch.id?.length <= 11,
"nicovideo": (patternMatch) =>
// checking if this page is video and if identifier is number
patternMatch.id.startsWith("sm") && !isNaN(parseInt(patternMatch.id.substring(2), 10))
}