diff --git a/lib/routes/eztv/imdb.js b/lib/routes/eztv/imdb.js
index 0e70a67d6c0d71..f744b88ae0f29b 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) => {
@@ -11,18 +13,22 @@ 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(),
+ pubDate: dayjs.unix(item.date_released_unix).toDate(),
link: item.torrent_url,
})),
};