more youtube links
This commit is contained in:
parent
ea2d033978
commit
f2a0eeb799
@ -39,7 +39,7 @@
|
||||
},
|
||||
{
|
||||
"name": "urlreply",
|
||||
"version": "1.1.0"
|
||||
"version": "1.1.1"
|
||||
},
|
||||
{
|
||||
"name": "utility",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"main": "plugin.js",
|
||||
"name": "urlreply",
|
||||
"description": "Fetch titles from web pages, specifically made for IRC",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"tags": ["irc"],
|
||||
"dependencies": [],
|
||||
"npmDependencies": ["cheerio@^1.0.0-rc.10"]
|
||||
|
@ -20,7 +20,7 @@ interface URLHandler {
|
||||
let urlHandlers: { [key: string]: URLHandler } = {};
|
||||
let htmlHandlers: any[] = [];
|
||||
|
||||
const urlRegex = /(((ftp|https?):\/\/)[-\w@:%_+.~#?,&//=]+)/g;
|
||||
const urlRegex = /(((ftp|https?):\/\/)[-\w@:%_+.~#?,&//=()]+)/g;
|
||||
|
||||
function findUrls(text: string): string[] {
|
||||
const source = (text || '').toString();
|
||||
@ -343,6 +343,48 @@ class URLReplyPlugin extends Plugin {
|
||||
}
|
||||
);
|
||||
|
||||
this.registerHandler(
|
||||
this.name,
|
||||
'youtube.com/shorts/',
|
||||
async (url: urllib.URL, msg: IMessage, data: any) => {
|
||||
const det = url.pathname.split('/')[2];
|
||||
|
||||
if (!det) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getYoutubeFromVideo.apply(this, [this, det, url, msg]);
|
||||
}
|
||||
);
|
||||
|
||||
this.registerHandler(
|
||||
this.name,
|
||||
'youtube.com/live/',
|
||||
async (url: urllib.URL, msg: IMessage, data: any) => {
|
||||
const det = url.pathname.split('/')[2];
|
||||
|
||||
if (!det) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getYoutubeFromVideo.apply(this, [this, det, url, msg]);
|
||||
}
|
||||
);
|
||||
|
||||
this.registerHandler(
|
||||
this.name,
|
||||
'youtube.com/v/',
|
||||
async (url: urllib.URL, msg: IMessage, data: any) => {
|
||||
const det = url.pathname.split('/')[2];
|
||||
|
||||
if (!det) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getYoutubeFromVideo.apply(this, [this, det, url, msg]);
|
||||
}
|
||||
);
|
||||
|
||||
// Dailymotion
|
||||
this.registerHandler(
|
||||
this.name,
|
||||
|
Loading…
Reference in New Issue
Block a user