configurable ryd url
This commit is contained in:
parent
51df207701
commit
05db7ca20f
@ -39,7 +39,7 @@
|
||||
},
|
||||
{
|
||||
"name": "urlreply",
|
||||
"version": "1.0.6"
|
||||
"version": "1.0.8"
|
||||
},
|
||||
{
|
||||
"name": "utility",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"main": "plugin.js",
|
||||
"name": "urlreply",
|
||||
"description": "Fetch titles from web pages, specifically made for IRC",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.8",
|
||||
"tags": ["irc"],
|
||||
"dependencies": [],
|
||||
"npmDependencies": ["cheerio@^1.0.0-rc.10"]
|
||||
|
@ -124,6 +124,7 @@ async function getYoutubeFromVideo(
|
||||
full: urllib.URL,
|
||||
msg: IMessage): Promise<boolean> {
|
||||
const gtoken = plugin.config.get('tokens.google');
|
||||
const dislikeAPIBase = plugin.config.get('api.returnyoutubedislike');
|
||||
|
||||
if (!gtoken) {
|
||||
return false;
|
||||
@ -144,13 +145,15 @@ async function getYoutubeFromVideo(
|
||||
return false;
|
||||
}
|
||||
|
||||
const dislikeAPI = `https://returnyoutubedislikeapi.com/votes?videoId=${id}`;
|
||||
let dislikeData;
|
||||
try {
|
||||
dislikeData = await httpGET(dislikeAPI);
|
||||
dislikeData = JSON.parse(dislikeData);
|
||||
} catch (e) {
|
||||
dislikeData = null;
|
||||
if (dislikeAPIBase) {
|
||||
const dislikeAPI = `${dislikeAPIBase}/votes?videoId=${id}`;
|
||||
try {
|
||||
dislikeData = await httpGET(dislikeAPI);
|
||||
dislikeData = JSON.parse(dislikeData);
|
||||
} catch (e) {
|
||||
dislikeData = null;
|
||||
}
|
||||
}
|
||||
|
||||
const vid = data.items[0];
|
||||
@ -219,6 +222,9 @@ async function getYoutubeFromVideo(
|
||||
tokens: {
|
||||
google: null,
|
||||
soundcloud: null
|
||||
},
|
||||
api: {
|
||||
returnyoutubedislike: 'https://returnyoutubedislikeapi.com'
|
||||
}
|
||||
})
|
||||
class URLReplyPlugin extends Plugin {
|
||||
|
@ -18,6 +18,16 @@
|
||||
"description": "Soundcloud API token"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api": {
|
||||
"type": "object",
|
||||
"description": "API URLs",
|
||||
"properties": {
|
||||
"returnyoutubedislike": {
|
||||
"type": "string",
|
||||
"description": "API URL for ReturnYoutubeDislike"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["tokens"]
|
||||
|
Loading…
Reference in New Issue
Block a user