mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-11 09:30:06 -04:00
wip
This commit is contained in:
parent
bce76d2fb7
commit
a24cbb3543
7 changed files with 135 additions and 60 deletions
|
@ -3,7 +3,8 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const axios = require('axios')
|
||||
const axiosDelayAdapter = require('axios-delay').default
|
||||
const axiosCookieJarSupport = require('axios-cookiejar-support').default
|
||||
const tough = require('tough-cookie')
|
||||
const utils = require('./utils')
|
||||
const { Command } = require('commander')
|
||||
const program = new Command()
|
||||
|
@ -14,6 +15,10 @@ dayjs.extend(utc)
|
|||
dayjs.extend(timezone)
|
||||
dayjs.tz.setDefault('UTC')
|
||||
|
||||
axiosCookieJarSupport(axios)
|
||||
|
||||
const cookieJar = new tough.CookieJar()
|
||||
|
||||
program
|
||||
.version('0.1.0', '-v, --version')
|
||||
.name('epg-grabber')
|
||||
|
@ -29,8 +34,9 @@ const config = utils.parseConfig(options.config)
|
|||
const sites = utils.loadSites(options.sites)
|
||||
|
||||
const client = axios.create({
|
||||
adapter: axiosDelayAdapter(axios.defaults.adapter),
|
||||
headers: { 'User-Agent': config.userAgent }
|
||||
headers: { 'User-Agent': config.userAgent, Cookie: config.cookie },
|
||||
withCredentials: true,
|
||||
jar: cookieJar
|
||||
})
|
||||
|
||||
async function main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue