WebEmbed shorten api

This commit is contained in:
March 7th 2022-04-01 18:26:43 +07:00
parent 5b0ebe175b
commit 95dd8ae90a

View File

@ -287,18 +287,22 @@ class WebEmbed {
} }
} }
// API by Shiraori#1782 (me) // Credit: https://www.npmjs.com/package/node-url-shortener + google :))
const getShorten = async (url) => { const getShorten = async (url) => {
// Please not using this API, it's hosting in Heroku, very slow const APIurl = [
'https://is.gd/create.php?format=simple&url=',
'https://tinyurl.com/api-create.php?url=',
// 'https://cdpt.in/shorten?url=', Redirects 5s :(
];
try { try {
const res = await axios const res = await axios.get(
.post('https://sagiri-fansub.tk/api/v1/embed', { `${APIurl[Math.floor(Math.random() * APIurl.length)]}${url}`,
url, );
}) return `${res.data}`;
return `https://sagiri-fansub.tk/api/v1/embed/${res.data.path}`;
} catch { } catch {
return void 0; return void 0;
} }
} }
module.exports = WebEmbed; module.exports = WebEmbed;
module.exports.hiddenEmbed = hiddenCharter;