From 7e5725064e43ef62951e7c8e486d8b4ac229820c Mon Sep 17 00:00:00 2001 From: Ashley Date: Wed, 21 Dec 2022 15:42:06 +0000 Subject: [PATCH] add try catch :p --- src/libpoketube/libpoketube-fetcher.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/libpoketube/libpoketube-fetcher.js b/src/libpoketube/libpoketube-fetcher.js index 196ab33e..d8e83822 100644 --- a/src/libpoketube/libpoketube-fetcher.js +++ b/src/libpoketube/libpoketube-fetcher.js @@ -38,10 +38,17 @@ module.exports = async function (video_id) { */ async function parsexml(id) { - const player = await fetch(`${new_api_url}?v=${id}`, headers); - var h = await player.text(); - var j = toJson(h); - return getJson(j); + async function fetchxmlvideo() { + try { + const player = await fetch(`${new_api_url}?v=${id}`, headers); + var h = await player.text(); + var j = toJson(h); + return getJson(j); + } catch {} + } + + const a = await fetchxmlvideo(); + return a; } async function ryd() {