add full.pr0gramm.com

This commit is contained in:
jkhsjdhjs 2018-09-14 20:10:49 +02:00
parent 3f46d69b39
commit 5ba5ff0afb
Signed by: jkhsjdhjs
GPG Key ID: BAC6ADBAB7D576CC

View File

@ -14,7 +14,7 @@ const flags = {
4: "[color=red]nsfl[/color]", 4: "[color=red]nsfl[/color]",
8: "[color=blue]nsfp[/color]" 8: "[color=blue]nsfp[/color]"
}; };
const regex = /(img|vid)\.pr0gramm\.com\/((?:\d+){4}\/(?:\d+){2}(\/(?:\d+){2})?\/(?:\w{1,20})\.(?:webm|png|jpg|mp4|webm)?)/gi; const regex = /(full|img|vid)\.pr0gramm\.com\/((?:\d+){4}\/(?:\d+){2}(\/(?:\d+){2})?\/(?:\w{1,20})\.(?:gif|png|jpg|mp4)?)/gi;
const site = "https://pr0gramm.com/new/"; const site = "https://pr0gramm.com/new/";
export default bot => { export default bot => {
@ -26,9 +26,10 @@ export default bot => {
const tmp = url.parse(link).path.substr(1); const tmp = url.parse(link).path.substr(1);
rp(apis.reverse + tmp) rp(apis.reverse + tmp)
.then(res => { .then(res => {
res = JSON.parse(res);
if(res.error) if(res.error)
throw res.error; throw res.error;
return JSON.parse(res).data.id; return res.data.id;
}) })
.then(id => Promise.all([ .then(id => Promise.all([
rp(apis.pr0gag.list + id.toString()), rp(apis.pr0gag.list + id.toString()),
@ -63,7 +64,7 @@ export default bot => {
`toptags: ${meta.toptags.join(", ")} (${meta.flag})` `toptags: ${meta.toptags.join(", ")} (${meta.flag})`
]) ])
.then(out => e.reply(out.join(" - "))) .then(out => e.reply(out.join(" - ")))
).catch(err => e.reply("wo pr0gagcrawler jkhsjdhjs")); ).catch(err => e.reply(JSON.stringify(err)));
} }
})); }));
}; };