From 3142306a0c5621e70934448c2e8f3f26cb1d5192 Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Sun, 27 Dec 2020 21:20:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96tools=E4=BD=BF=E6=9F=90?= =?UTF-8?q?=E4=BA=9B=E6=BA=90=E7=AB=99api=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/site/tools.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/site/tools.js b/src/lib/site/tools.js index 9055e43..5625d1e 100644 --- a/src/lib/site/tools.js +++ b/src/lib/site/tools.js @@ -149,7 +149,11 @@ const zy = { const json = parser.parse(data, this.xmlConfig) const jsondata = json.rss === undefined ? json : json.rss const videoList = jsondata.list.video - resolve(videoList) + if (videoList && videoList.length) { + resolve(videoList) + } else { + resolve([]) + } }).catch(err => { reject(err) }) @@ -173,7 +177,7 @@ const zy = { url = `${site.api}?ac=videolist` } axios.post(url).then(async res => { - const data = res.data + const data = res.data.match(/]*>/)[0] + '' // 某些源站不含页码时获取到的数据parser无法解析 const json = parser.parse(data, this.xmlConfig) const jsondata = json.rss === undefined ? json : json.rss const pg = { @@ -239,7 +243,7 @@ const zy = { if (type === '[object Array]') { for (const i of dd) { // 如果含有多个视频列表的话, 仅获取m3u8列表 - if (i._flag.includes('m3u8')) { + if (i._flag.includes('m3u8') || i._t.includes('.m3u8')) { m3u8List = i._t.split('#') } }