mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 02:16:40 -05:00
Update grab.js
This commit is contained in:
@@ -10,6 +10,7 @@ const convert = require('xml-js')
|
||||
program
|
||||
.option('--channels <channels>', 'Path to channels.xml file')
|
||||
.option('--output <output>', 'Path to output file', 'guide.xml')
|
||||
.option('--days <days>', 'Number of days for which to grab the program', parseInteger, 1)
|
||||
.parse(process.argv)
|
||||
|
||||
const options = program.opts()
|
||||
@@ -32,6 +33,7 @@ async function main() {
|
||||
for (let channel of channels) {
|
||||
const configPath = `sites/${channel.site}.config.js`
|
||||
const config = require(path.resolve(configPath))
|
||||
config.days = options.days
|
||||
await grabber
|
||||
.grab(channel, config, (item, err) => {
|
||||
console.log(
|
||||
@@ -90,3 +92,7 @@ function writeToFile(filename, data) {
|
||||
|
||||
fs.writeFileSync(path.resolve(filename), data)
|
||||
}
|
||||
|
||||
function parseInteger(val) {
|
||||
return val ? parseInt(val) : null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user