more youtube links
This commit is contained in:
parent
ea2d033978
commit
f2a0eeb799
@ -39,7 +39,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "urlreply",
|
"name": "urlreply",
|
||||||
"version": "1.1.0"
|
"version": "1.1.1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utility",
|
"name": "utility",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"main": "plugin.js",
|
"main": "plugin.js",
|
||||||
"name": "urlreply",
|
"name": "urlreply",
|
||||||
"description": "Fetch titles from web pages, specifically made for IRC",
|
"description": "Fetch titles from web pages, specifically made for IRC",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"tags": ["irc"],
|
"tags": ["irc"],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"npmDependencies": ["cheerio@^1.0.0-rc.10"]
|
"npmDependencies": ["cheerio@^1.0.0-rc.10"]
|
||||||
|
@ -20,7 +20,7 @@ interface URLHandler {
|
|||||||
let urlHandlers: { [key: string]: URLHandler } = {};
|
let urlHandlers: { [key: string]: URLHandler } = {};
|
||||||
let htmlHandlers: any[] = [];
|
let htmlHandlers: any[] = [];
|
||||||
|
|
||||||
const urlRegex = /(((ftp|https?):\/\/)[-\w@:%_+.~#?,&//=]+)/g;
|
const urlRegex = /(((ftp|https?):\/\/)[-\w@:%_+.~#?,&//=()]+)/g;
|
||||||
|
|
||||||
function findUrls(text: string): string[] {
|
function findUrls(text: string): string[] {
|
||||||
const source = (text || '').toString();
|
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
|
// Dailymotion
|
||||||
this.registerHandler(
|
this.registerHandler(
|
||||||
this.name,
|
this.name,
|
||||||
|
Loading…
Reference in New Issue
Block a user