simplification

This commit is contained in:
mose 2019-09-15 17:45:01 +08:00
parent 64db9d65b2
commit 5c6d2aa253

View file

@ -13,11 +13,9 @@ bot.global.text(/(https?:\/\/[^ ,\)"]*)/ig, (b) => {
var re = /<title[^>]*>([^<]*)<\/title>/gi; var re = /<title[^>]*>([^<]*)<\/title>/gi;
var match = re.exec(body); var match = re.exec(body);
if (match && match[1]) { if (match && match[1]) {
// b.respondEnvelope({ attachments: [] })
// b.envelope.payload.quickReply({ attachments: [] });
var extra = ""; var extra = "";
var link = res.request.uri.href; var link = res.request.uri.href;
if (/youtube.com/.test(res.request.uri.href)) { if (/youtube.com/.test(link)) {
if (t = /[?&]v=([^&]+)/.exec(link)) { if (t = /[?&]v=([^&]+)/.exec(link)) {
link = "https://www.youtube.com/watch?v=" + t[1]; link = "https://www.youtube.com/watch?v=" + t[1];
extra += " - [no-cookie](https://www.youtube-nocookie.com/embed/" + t[1] + ")"; extra += " - [no-cookie](https://www.youtube-nocookie.com/embed/" + t[1] + ")";