mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 20:03:40 +01:00
onlyHEVC flag and more URL checking
This commit is contained in:
parent
3520ec1912
commit
3bd2754b3a
117
FeedFilter.js
117
FeedFilter.js
@ -1,52 +1,95 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const { linkAdder } = require('./JDLinkAdder');
|
const { linkAdder } = require('./JDLinkAdder');
|
||||||
const { getLinksFromURL } = require('./LinkGrabber')
|
const { getLinksFromURL } = require('./LinkGrabber')
|
||||||
|
const { checkFileName } = require('./checkFileName')
|
||||||
|
|
||||||
async function filterFeed() {
|
async function filterFeed() {
|
||||||
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
||||||
|
let hevcSwitch = JSON.parse(fs.readFileSync('config.json')).OnlyHEVC
|
||||||
let feed = JSON.parse(fs.readFileSync('./feedCache.json'));
|
let feed = JSON.parse(fs.readFileSync('./feedCache.json'));
|
||||||
|
|
||||||
myshowlist.forEach(async show => {
|
|
||||||
try {
|
if (hevcSwitch) {
|
||||||
// Find show on feed
|
myshowlist.forEach(async show => {
|
||||||
let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name))
|
try {
|
||||||
if (list_filtered_for_show.length > 0) {
|
// Find show on feed
|
||||||
// If show is found get url then return all links on that page
|
let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name))
|
||||||
let full_link_list_from_page = await getLinksFromURL(list_filtered_for_show[0].link)
|
if (list_filtered_for_show.length > 0) {
|
||||||
// Only get urls with HEVC in name
|
// If show is found get url then return all links on that page
|
||||||
let urls_with_HEVC_in_url = full_link_list_from_page.filter(item => item.includes('HEVC'))
|
let full_link_list_from_page = await getLinksFromURL(list_filtered_for_show[0].link)
|
||||||
if (urls_with_HEVC_in_url.length == 0) {
|
// Only get urls with HEVC in name
|
||||||
// If no urls with HEVC check for H265
|
let urls_with_HEVC_in_url = full_link_list_from_page.filter(item => item.includes('HEVC'))
|
||||||
urls_with_HEVC_in_url = full_link_list_from_page.filter(item => item.includes('H265'))
|
if (urls_with_HEVC_in_url.length == 0) {
|
||||||
}
|
// If no urls with HEVC check for H265
|
||||||
// Only keep urls that match show quality
|
urls_with_HEVC_in_url = full_link_list_from_page.filter(item => item.includes('H265'))
|
||||||
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
|
// 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_with_HEVC_in_url.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
|
||||||
let only_MeGusta_links = urls_without_torrent_in_url.filter(item => item.includes('MeGusta'))
|
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.
|
// Remove any url that doesn't include MeGusta
|
||||||
let remove_nitroflare = only_MeGusta_links.filter(item => !item.includes('nitro'))
|
let only_MeGusta_links = urls_without_torrent_in_url.filter(item => item.includes('MeGusta'))
|
||||||
// Send Links to JDdownloader
|
// NitroFlare doesn't group with the rest of the links in JD, remove them.
|
||||||
if (remove_nitroflare.length !== 0) {
|
let remove_nitroflare = only_MeGusta_links.filter(item => !item.includes('nitro'))
|
||||||
log.info(remove_nitroflare.length + ' links for ' + show.Name + ' have been sent to JDdownloader')
|
// Do some stuff
|
||||||
linkAdder(remove_nitroflare)
|
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')
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// No HEVC links found
|
// Show not found on the current feed cache
|
||||||
log.info(remove_nitroflare.length + ' HEVC links for ' + show.Name + ' have been found')
|
log.info(show.Name + ' not on feed')
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
} else {
|
log.error('Something went wrong ' + error)
|
||||||
// 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')
|
} else {
|
||||||
// fs.writeFileSync(global.fileName, JSON.stringify('[]'));
|
myshowlist.forEach(async show => {
|
||||||
|
try {
|
||||||
|
// 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 + ' links for ' + show.Name + ' have been found')
|
||||||
|
}
|
||||||
|
|
||||||
|
} 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')
|
||||||
|
fs.writeFileSync('./feedCache.json', JSON.stringify('[]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
12
checkFileName.js
Normal file
12
checkFileName.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
function checkFileName(urls) {
|
||||||
|
let urlList = []
|
||||||
|
urls.forEach(url => {
|
||||||
|
let cut = url.match(/([^\/]*$)/mg);
|
||||||
|
if (cut[0] !== '') {
|
||||||
|
urlList.push(url)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return urlList
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { checkFileName }
|
@ -5,6 +5,7 @@
|
|||||||
"RSSFeedRefreshMins": 10,
|
"RSSFeedRefreshMins": 10,
|
||||||
"JDPostLinksMins": 180,
|
"JDPostLinksMins": 180,
|
||||||
"Autostart": false,
|
"Autostart": false,
|
||||||
|
"OnlyHEVC": true,
|
||||||
"Shows": [
|
"Shows": [
|
||||||
{
|
{
|
||||||
"Name": "",
|
"Name": "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user