epg-grabber 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/bin/epg-grabber.js +2 -0
- package/package.json +2 -1
- package/src/utils.js +11 -0
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ Arguments:
|
|
|
81
81
|
- `--delay`: delay between requests (default: 3000)
|
|
82
82
|
- `--timeout`: set a timeout for each request (default: 5000)
|
|
83
83
|
- `--debug`: enable debug mode (default: false)
|
|
84
|
+
- `--curl`: display current request as CURL (default: false)
|
|
84
85
|
- `--log`: path to log file (optional)
|
|
85
86
|
- `--log-level`: set the log level (default: 'info')
|
|
86
87
|
|
package/bin/epg-grabber.js
CHANGED
|
@@ -23,6 +23,7 @@ program
|
|
|
23
23
|
.option('--delay <delay>', 'Delay between requests (in mileseconds)', parseInteger)
|
|
24
24
|
.option('--timeout <timeout>', 'Set a timeout for each request (in mileseconds)', parseInteger)
|
|
25
25
|
.option('--debug', 'Enable debug mode', false)
|
|
26
|
+
.option('--curl', 'Display request as CURL', false)
|
|
26
27
|
.option('--log <log>', 'Path to log file')
|
|
27
28
|
.option('--log-level <level>', 'Set log level', 'info')
|
|
28
29
|
.parse(process.argv)
|
|
@@ -64,6 +65,7 @@ async function main() {
|
|
|
64
65
|
config = merge(config, {
|
|
65
66
|
days: options.days,
|
|
66
67
|
debug: options.debug,
|
|
68
|
+
curl: options.curl,
|
|
67
69
|
lang: options.lang,
|
|
68
70
|
delay: options.delay,
|
|
69
71
|
request: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epg-grabber",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Node.js CLI tool for grabbing EPG from different sites",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"preferGlobal": true,
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"axios-cookiejar-support": "^1.0.1",
|
|
33
33
|
"axios-mock-adapter": "^1.20.0",
|
|
34
34
|
"commander": "^7.1.0",
|
|
35
|
+
"curl-generator": "^0.2.0",
|
|
35
36
|
"dayjs": "^1.10.4",
|
|
36
37
|
"glob": "^7.1.6",
|
|
37
38
|
"lodash": "^4.17.21",
|
package/src/utils.js
CHANGED
|
@@ -8,6 +8,7 @@ const convert = require('xml-js')
|
|
|
8
8
|
const { merge } = require('lodash')
|
|
9
9
|
const dayjs = require('dayjs')
|
|
10
10
|
const utc = require('dayjs/plugin/utc')
|
|
11
|
+
const { CurlGenerator } = require('curl-generator')
|
|
11
12
|
dayjs.extend(utc)
|
|
12
13
|
axiosCookieJarSupport(axios)
|
|
13
14
|
|
|
@@ -208,6 +209,16 @@ utils.buildRequest = async function (item, config) {
|
|
|
208
209
|
console.log('Request:', JSON.stringify(request, null, 2))
|
|
209
210
|
}
|
|
210
211
|
|
|
212
|
+
if (config.curl) {
|
|
213
|
+
const curl = CurlGenerator({
|
|
214
|
+
url: request.url,
|
|
215
|
+
method: request.method,
|
|
216
|
+
headers: request.headers,
|
|
217
|
+
body: request.data
|
|
218
|
+
})
|
|
219
|
+
console.log(curl)
|
|
220
|
+
}
|
|
221
|
+
|
|
211
222
|
return request
|
|
212
223
|
}
|
|
213
224
|
|