new code for hevcswitch

This commit is contained in:
karl.hudgell 2022-06-16 07:41:15 +01:00
parent 0bbd83f375
commit 41392b0da7

View File

@ -10,83 +10,55 @@ async function filterFeed() {
let retry_show_cache = [] let retry_show_cache = []
if (hevcSwitch) { for (let show of myshowlist) {
for (let show of myshowlist) {
try { try {
// 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 // If show is found get url then return all links on that page
let full_link_list_from_page = await getLinksFromURL(list_filtered_for_show[0].link) let full_link_list_from_page = await getLinksFromURL(list_filtered_for_show[0].link)
if (hevcSwitch) {
// Only get urls with HEVC in name // Only get urls with HEVC in name
let urls_with_HEVC_in_url = full_link_list_from_page.filter(item => item.includes('HEVC')) let urls_with_HEVC_in_url = full_link_list_from_page.filter(item => item.includes('HEVC'))
if (urls_with_HEVC_in_url.length == 0) { if (urls_with_HEVC_in_url.length == 0) {
// If no urls with HEVC check for H265 // If no urls with HEVC check for H265
urls_with_HEVC_in_url = full_link_list_from_page.filter(item => item.includes('H265')) urls_to_check = full_link_list_from_page.filter(item => item.includes('H265'))
}
// Only keep urls that match show quality
let urls_with_quality_in_url = urls_with_HEVC_in_url.filter(item => item.includes(show.Quality))
// Remove any url trying to direct to a torrent site search
let urls_without_torrent_in_url = urls_with_quality_in_url.filter(item => !item.includes('torrent'))
// Remove any url that doesn't include MeGusta
let only_MeGusta_links = urls_without_torrent_in_url.filter(item => item.includes('MeGusta'))
// NitroFlare doesn't group with the rest of the links in JD, remove them.
let remove_nitroflare = only_MeGusta_links.filter(item => !item.includes('nitro'))
// Do some stuff
let download_list = checkFileName(remove_nitroflare)
// Send Links to JDdownloader
if (download_list.length !== 0) {
log.info(download_list.length + ' links for ' + show.Name + ' have been sent to JDdownloader')
linkAdder(download_list)
} else {
// No HEVC links found
log.info(download_list.length + ' HEVC links for ' + show.Name + ' have been found, will recheck next time.')
for (let feed_item of list_filtered_for_show) {
retry_show_cache.push(feed_item)
}
} }
} else { } else {
// Show not found on the current feed cache urls_to_check = full_link_list_from_page
log.info(show.Name + ' not on feed')
} }
} catch (error) { // Only keep urls that match show quality
log.error('Something went wrong ' + error) 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
} let urls_without_torrent_in_url = urls_with_quality_in_url.filter(item => !item.includes('torrent'))
} else { // Remove any url that doesn't include MeGusta
for (let show of myshowlist) { if (hevcSwitch) {
try { pre_nitroFlare = urls_without_torrent_in_url.filter(item => item.includes('MeGusta'))
// Find show on feed
let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name))
if (list_filtered_for_show.length > 0) {
// If show is found get url then return all links on that page
let full_link_list_from_page = await getLinksFromURL(list_filtered_for_show[0].link)
// Only keep urls that match show quality
let urls_with_quality_in_url = full_link_list_from_page.filter(item => item.includes(show.Quality))
// Remove any url trying to direct to a torrent site search
let urls_without_torrent_in_url = urls_with_quality_in_url.filter(item => !item.includes('torrent'))
// NitroFlare doesn't group with the rest of the links in JD, remove them.
let remove_nitroflare = urls_without_torrent_in_url.filter(item => !item.includes('nitro'))
// Do some stuff
let download_list = checkFileName(remove_nitroflare)
// Send Links to JDdownloader
if (download_list.length !== 0) {
log.info(download_list.length + ' links for ' + show.Name + ' have been sent to JDdownloader')
linkAdder(download_list)
} else {
// No links found
log.info(download_list.length + ' HEVC links for ' + show.Name + ' have been found, will recheck next time.')
for (let feed_item of list_filtered_for_show) {
retry_show_cache.push(feed_item)
}
}
} else { } else {
// Show not found on the current feed cache pre_nitroFlare = urls_without_torrent_in_url
log.info(show.Name + ' not on feed')
} }
} catch (error) { // NitroFlare doesn't group with the rest of the links in JD, remove them.
log.error('Something went wrong ' + error) let remove_nitroflare = pre_nitroFlare.filter(item => !item.includes('nitro'))
// Do some stuff
let download_list = checkFileName(remove_nitroflare)
// Send Links to JDdownloader
if (download_list.length !== 0) {
log.info(download_list.length + ' links for ' + show.Name + ' have been sent to JDdownloader')
linkAdder(download_list)
} else {
// No HEVC links found
log.info(download_list.length + ' links for ' + show.Name + ' have been found, will recheck next time.')
for (let feed_item of list_filtered_for_show) {
retry_show_cache.push(feed_item)
}
}
} else {
// Show not found on the current feed cache
log.info(show.Name + ' not on feed')
} }
} catch (error) {
log.error('Something went wrong ' + error)
} }
} }
log.info('Wiping feed cache') log.info('Wiping feed cache')