nicothumb2img
code:middleware.ts
export const formatNiconico = (url: URL): URL | string => {
if (!/^(?:\w+\.nicovideo\.jp|nico\.ms)$/.test(url.hostname)) return url;
const id = url.pathname.match(/(?:sm|nm|so|ca|ax|yo|nl|ig|na|cw|za-e|om|sk|yk|lv)\d{1,14}$/)?.0; return id ? [https://nicothumb2img.vercel.app/image/${id}#.png https://nico.ms/${id}] : url;
};