From 4679cdbf64839c900ca9ab3e3a359837f4870153 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Mon, 10 May 2021 13:44:25 +0800 Subject: [PATCH 1/4] fix: eztv empty response --- lib/routes/eztv/imdb.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/routes/eztv/imdb.js b/lib/routes/eztv/imdb.js index 0e70a67d6c0d71..6c8c9d3e22d83d 100644 --- a/lib/routes/eztv/imdb.js +++ b/lib/routes/eztv/imdb.js @@ -11,15 +11,19 @@ module.exports = async (ctx) => { }, }); - const { torrents } = response.data; + let torrents = []; + if (response.data.torrents_count !== 0) { + torrents = response.data.torrents; + } ctx.state.data = { title: `EZTV's Torrents of IMBD ID: ${imdb_id}`, link: 'https://eztv.it', description: `EZTV's Torrents of IMBD ID: ${imdb_id}`, + allowEmpty: true, item: torrents.map((item) => ({ title: item.title, - description: ``, + description: ``, enclosure_url: item.magnet_url, enclosure_type: 'application/x-bittorrent', pubDate: new Date(item.date_released_unix * 1000).toUTCString(), From 0b182c0dfe00609b0bf970ee82bbaa0bc778d7f6 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Mon, 10 May 2021 13:47:37 +0800 Subject: [PATCH 2/4] diff From 8b6a1c8d1d65c9b10df233dde0ba4331a9161411 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Wed, 12 May 2021 12:47:14 +0800 Subject: [PATCH 3/4] using new date time utils --- lib/routes/eztv/imdb.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/routes/eztv/imdb.js b/lib/routes/eztv/imdb.js index 6c8c9d3e22d83d..5aa8e8777fd5a8 100644 --- a/lib/routes/eztv/imdb.js +++ b/lib/routes/eztv/imdb.js @@ -1,3 +1,5 @@ +const dayjs = require('dayjs'); + const got = require('@/utils/got'); module.exports = async (ctx) => { @@ -26,7 +28,7 @@ module.exports = async (ctx) => { description: ``, enclosure_url: item.magnet_url, enclosure_type: 'application/x-bittorrent', - pubDate: new Date(item.date_released_unix * 1000).toUTCString(), + pubDate: dayjs.unix(item.date_released_unix), link: item.torrent_url, })), }; From 1f28f164d570312b0b9ff3f31042652f09c4a9a3 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Wed, 12 May 2021 12:49:58 +0800 Subject: [PATCH 4/4] should return `Date` object --- lib/routes/eztv/imdb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/eztv/imdb.js b/lib/routes/eztv/imdb.js index 5aa8e8777fd5a8..f744b88ae0f29b 100644 --- a/lib/routes/eztv/imdb.js +++ b/lib/routes/eztv/imdb.js @@ -28,7 +28,7 @@ module.exports = async (ctx) => { description: ``, enclosure_url: item.magnet_url, enclosure_type: 'application/x-bittorrent', - pubDate: dayjs.unix(item.date_released_unix), + pubDate: dayjs.unix(item.date_released_unix).toDate(), link: item.torrent_url, })), };