fix multilink url metadata
This commit is contained in:
parent
69bd3e60c9
commit
16de4347cb
1 changed files with 11 additions and 3 deletions
|
@ -7,10 +7,14 @@ var request_options = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bot.global.text(/(https?:\/\/[^ ,\)"\n]*)/ig, (b) => {
|
|
||||||
// console.log(JSON.stringify(b.envelope.payload, null, 2));
|
|
||||||
|
bot.global.text(/(https?:\/\/[^ ,\)"\n]*)/ig, async (b) => {
|
||||||
|
// console.log(JSON.stringify(b.match, null, 2));
|
||||||
for (url of b.match) {
|
for (url of b.match) {
|
||||||
// console.log(JSON.stringify(url, null, 2));
|
console.log('-----------------------------------');
|
||||||
|
console.log(JSON.stringify(url, null, 2));
|
||||||
|
console.log('-----------------------------------');
|
||||||
if (!/(coa|pad)\.crapaud-fou\.org/.test(url)) {
|
if (!/(coa|pad)\.crapaud-fou\.org/.test(url)) {
|
||||||
request_options.url = url;
|
request_options.url = url;
|
||||||
request(request_options, (err, res, body) => {
|
request(request_options, (err, res, body) => {
|
||||||
|
@ -28,6 +32,9 @@ bot.global.text(/(https?:\/\/[^ ,\)"\n]*)/ig, (b) => {
|
||||||
extra += " - [invidious](https://invidio.us/watch?v=" + t[1] + ")";
|
extra += " - [invidious](https://invidio.us/watch?v=" + t[1] + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('-----------------------------------');
|
||||||
|
console.log(JSON.stringify(link, null, 2));
|
||||||
|
console.log('-----------------------------------');
|
||||||
b.respond("[>>>](" + link + ") _" + match[1].replace(/\n/g, " ") + "_" + extra);
|
b.respond("[>>>](" + link + ") _" + match[1].replace(/\n/g, " ") + "_" + extra);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -41,6 +48,7 @@ bot.global.text(/(https?:\/\/[^ ,\)"\n]*)/ig, (b) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
id: 'get-url-metadata'
|
id: 'get-url-metadata'
|
||||||
|
|
Loading…
Reference in a new issue