This commit is contained in:
Aleksandr Statciuk 2022-06-16 22:14:55 +03:00
parent d22a02fa9f
commit 26b30eddcc
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ const { CurlGenerator } = require('curl-generator')
const axios = require('axios').default
const axiosCookieJarSupport = require('axios-cookiejar-support').default
const { setupCache } = require('axios-cache-interceptor')
const { isObject, isPromise, getUTCDate } = require('./utils')
const { isObject, isPromise } = require('./utils')
axiosCookieJarSupport(axios)
@ -68,7 +68,6 @@ function create(config) {
}
async function buildRequest({ channel, date, config }) {
date = typeof date === 'string' ? getUTCDate(date) : date
const CancelToken = axios.CancelToken
const source = CancelToken.source()
const request = { ...config.request }

View File

@ -1,9 +1,9 @@
const { merge } = require('lodash')
const { create: createClient, buildRequest, parseResponse } = require('./client')
const { parseChannels, parsePrograms } = require('./parser')
const { sleep, isPromise, getUTCDate } = require('./utils')
const { generate: generateXMLTV } = require('./xmltv')
const { load: loadConfig } = require('./config')
const { sleep, isPromise } = require('./utils')
const Channel = require('./Channel')
const Program = require('./Program')
@ -29,6 +29,7 @@ class EPGGrabber {
async grab(channel, date, cb = () => {}) {
await sleep(this.config.delay)
date = typeof date === 'string' ? getUTCDate(date) : date
return buildRequest({ channel, date, config: this.config })
.then(this.client)
.then(parseResponse)