fix: no items showing up in RSS

This commit is contained in:
ThaUnknown 2022-04-11 16:05:19 +02:00
parent e1161067a4
commit 0fe922146f
2 changed files with 12 additions and 11 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "1.4.1",
"version": "1.4.2",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"main": "src/index.js",
"homepage": "https://github.com/ThaUnknown/miru#readme",

View file

@ -117,21 +117,14 @@
const url = new URL(`https://nyaa.si/?page=rss&c=1_2&f=${trusted}&s=seeders&o=desc&q=(${titles})${ep}${quality}-(${excl})`)
nodes = [...nodes, ...(await getRSSContent(url)).querySelectorAll('item')]
}
if (!nodes.length) {
addToast({
text: `Couldn't find torrent for ${media.title.userPreferred} Episode ${parseInt(episode)}! Try specifying a torrent manually.`,
title: 'Search Failed',
type: 'danger'
})
return
}
const entries = []
const checkDate = media.status === 'FINISHED' && !prequel && (sequel?.status === 'FINISHED' || sequel?.status === 'RELEASING') && sequel.startDate
const targetDate = new Date(Object.values(checkDate).join(' '))
const targetDate = checkDate && new Date(Object.values(checkDate).join(' '))
for (const item of nodes) {
for (const item of nodes || []) {
const pubDate = item.querySelector('pubDate')?.textContent
const itemDate = pubDate && new Date(pubDate)
@ -151,6 +144,14 @@
entries.push(obj)
}
}
if (!entries.length) {
addToast({
text: `Couldn't find torrent for ${media.title.userPreferred} Episode ${parseInt(episode)}! Try specifying a torrent manually.`,
title: 'Search Failed',
type: 'danger'
})
return
}
entries.sort((a, b) => b.seeders - a.seeders)
const streamingEpisode = media?.streamingEpisodes.filter(episode => episodeRx.exec(episode.title) && Number(episodeRx.exec(episode.title)[1]) === Number(episode))[0]
fileMedia = {