download all if more than one post found

This commit is contained in:
karl.hudgell 2022-06-18 10:08:05 +01:00
parent a2f3a9ee69
commit 8b0040d8dd

View File

@ -17,41 +17,44 @@ async function filterFeed() {
// Find show on feed // Find show on feed
let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name)) let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name))
if (list_filtered_for_show.length > 0) { if (list_filtered_for_show.length > 0) {
// If show is found get url then return all links on that page for (let match of list_filtered_for_show) {
let full_link_list_from_page = await getLinksFromURL(list_filtered_for_show[0].link) // If show is found get url then return all links on that page
if (hevcSwitch) { let full_link_list_from_page = await getLinksFromURL(match.link)
// Only get urls with HEVC in name if (hevcSwitch) {
urls_to_check = full_link_list_from_page.filter(item => item.includes('HEVC')) // Only get urls with HEVC in name
if (urls_to_check.length == 0) { urls_to_check = full_link_list_from_page.filter(item => item.includes('HEVC'))
// If no urls with HEVC check for H265 if (urls_to_check.length == 0) {
urls_to_check = full_link_list_from_page.filter(item => item.includes('H265')) // If no urls with HEVC check for H265
urls_to_check = full_link_list_from_page.filter(item => item.includes('H265'))
}
} else {
urls_to_check = full_link_list_from_page
} }
} else { // Only keep urls that match show quality
urls_to_check = full_link_list_from_page let urls_with_quality_in_url = urls_to_check.filter(item => item.includes(show.Quality))
} // Remove any url trying to direct to a torrent site search
// Only keep urls that match show quality let urls_without_torrent_in_url = urls_with_quality_in_url.filter(item => !item.includes('torrent'))
let urls_with_quality_in_url = urls_to_check.filter(item => item.includes(show.Quality)) // Remove any url that doesn't include MeGusta
// Remove any url trying to direct to a torrent site search if (hevcSwitch) {
let urls_without_torrent_in_url = urls_with_quality_in_url.filter(item => !item.includes('torrent')) pre_nitroFlare = urls_without_torrent_in_url.filter(item => item.includes('MeGusta'))
// Remove any url that doesn't include MeGusta } else {
if (hevcSwitch) { pre_nitroFlare = urls_without_torrent_in_url
pre_nitroFlare = urls_without_torrent_in_url.filter(item => item.includes('MeGusta')) }
} else { // NitroFlare doesn't group with the rest of the links in JD, remove them.
pre_nitroFlare = urls_without_torrent_in_url let remove_nitroflare = pre_nitroFlare.filter(item => !item.includes('nitro'))
} // Do some stuff
// NitroFlare doesn't group with the rest of the links in JD, remove them. urlObj = checkFileName(remove_nitroflare)
let remove_nitroflare = pre_nitroFlare.filter(item => !item.includes('nitro')) let download_list = urlObj.urlList
// Do some stuff // Send Links to JDdownloader
let download_list = checkFileName(remove_nitroflare) if (download_list.length !== 0) {
// Send Links to JDdownloader log.info(download_list.length + ' links for ' + urlObj.fileName + ' have been sent to JDdownloader')
if (download_list.length !== 0) { linkAdder(download_list)
log.info(download_list.length + ' links for ' + show.Name + ' have been sent to JDdownloader') } else {
linkAdder(download_list) // No HEVC links found
} else { log.info(download_list.length + ' links for ' + show.Name + ' have been found, will recheck next time.')
// No HEVC links found for (let feed_item of list_filtered_for_show) {
log.info(download_list.length + ' links for ' + show.Name + ' have been found, will recheck next time.') retry_show_cache.push(feed_item)
for (let feed_item of list_filtered_for_show) { }
retry_show_cache.push(feed_item)
} }
} }
} else { } else {