mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-14 06:28:56 +01:00
add a check if json variable exists or not
Signed-off-by: Ashley <iamashley@duck.com>
This commit is contained in:
parent
29cf785969
commit
ab1bb9bd45
1 changed files with 20 additions and 15 deletions
|
@ -119,22 +119,27 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
let url;
|
let url;
|
||||||
if (j_.URL != undefined) url = j_.URL;
|
if (j_.URL != undefined) url = j_.URL;
|
||||||
|
|
||||||
if ("Title" in json) {
|
//checks if json exists
|
||||||
// json response
|
if (json) {
|
||||||
const re = {
|
//checks if title exists in the json object
|
||||||
main: {
|
|
||||||
video_id: sha384(json.id),
|
|
||||||
channel: sha384(json.Channel.Name),
|
|
||||||
title: sha384(json.Title),
|
|
||||||
date: sha384(btoa(Date.now()).toString()),
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
title: sha384(json.Title),
|
|
||||||
url: sha384(url),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
res.json(re);
|
if ("Title" in json) {
|
||||||
|
// json response
|
||||||
|
const re = {
|
||||||
|
main: {
|
||||||
|
video_id: sha384(json.id),
|
||||||
|
channel: sha384(json.Channel.Name),
|
||||||
|
title: sha384(json.Title),
|
||||||
|
date: sha384(btoa(Date.now()).toString()),
|
||||||
|
},
|
||||||
|
video: {
|
||||||
|
title: sha384(json.Title),
|
||||||
|
url: sha384(url),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
res.json(re);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue