epg-grabber 0.46.1 → 0.46.2

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/.prettierrc.js ADDED
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ tabWidth: 2,
3
+ useTabs: false,
4
+ endOfLine: "crlf",
5
+ semi: false,
6
+ singleQuote: true,
7
+ printWidth: 100,
8
+ trailingComma: "none",
9
+ arrowParens: "avoid",
10
+ };
package/README.md CHANGED
@@ -8,61 +8,6 @@ Node.js CLI tool for grabbing EPG from different websites.
8
8
  npm install -g epg-grabber
9
9
  ```
10
10
 
11
- ## Quick Start
12
-
13
- ```sh
14
- epg-grabber --config=example.com.config.js
15
- ```
16
-
17
- #### example.com.config.js
18
-
19
- ```js
20
- module.exports = {
21
- site: 'example.com',
22
- channels: 'example.com.channels.xml',
23
- url: function (context) {
24
- const { date, channel } = context
25
-
26
- return `https://api.example.com/${date.format('YYYY-MM-DD')}/channel/${channel.site_id}`
27
- },
28
- parser: function (context) {
29
- const programs = JSON.parse(context.content)
30
-
31
- return programs.map(program => {
32
- return {
33
- title: program.title,
34
- start: program.start,
35
- stop: program.stop
36
- }
37
- })
38
- }
39
- }
40
- ```
41
-
42
- #### example.com.channels.xml
43
-
44
- ```xml
45
- <?xml version="1.0" ?>
46
- <channels site="example.com">
47
- <channel site_id="cnn-23" xmltv_id="CNN.us">CNN</channel>
48
- </channels>
49
- ```
50
-
51
- ## Example Output
52
-
53
- ```xml
54
- <tv>
55
- <channel id="CNN.us">
56
- <display-name>CNN</display-name>
57
- <url>https://example.com</url>
58
- </channel>
59
- <programme start="20211116040000 +0000" stop="20211116050000 +0000" channel="CNN.us">
60
- <title lang="en">News at 10PM</title>
61
- </programme>
62
- // ...
63
- </tv>
64
- ```
65
-
66
11
  ## CLI
67
12
 
68
13
  ```sh
@@ -86,7 +31,15 @@ Arguments:
86
31
  - `--log`: path to log file (optional)
87
32
  - `--log-level`: set the log level (default: `info`)
88
33
 
89
- ## Site Config
34
+ ## How to use?
35
+
36
+ First, you need to create two files:
37
+
38
+ <details>
39
+ <summary>example.com.config.js</summary>
40
+ <br>
41
+
42
+ This file describes what kind of request we need to send to get the guide for a particular channel on a certain date and how to parse the response.
90
43
 
91
44
  ```js
92
45
  module.exports = {
@@ -182,14 +135,14 @@ module.exports = {
182
135
  }
183
136
  ```
184
137
 
185
- ## Request Context Object
138
+ ### Request Context Object
186
139
 
187
140
  Inside `url()`, `logo()`, `request.data()`, `request.headers()` functions in `config.js` you can access a `context` object containing the following data:
188
141
 
189
142
  - `channel`: The object describing the current channel (xmltv_id, site_id, name, lang)
190
143
  - `date`: The 'dayjs' instance with the requested date
191
144
 
192
- ## Parser Context Object
145
+ ### Parser Context Object
193
146
 
194
147
  Inside `parser()` function in `config.js` you can access a `context` object containing the following data:
195
148
 
@@ -201,7 +154,7 @@ Inside `parser()` function in `config.js` you can access a `context` object cont
201
154
  - `request`: The request config
202
155
  - `cached`: A boolean to check whether this request was cached or not
203
156
 
204
- ## Program Object
157
+ ### Program Object
205
158
 
206
159
  | Property | Aliases | Type | Required |
207
160
  | --------------- | -------------------------------- | ------------------------------------------------ | -------- |
@@ -371,7 +324,13 @@ Example:
371
324
  }
372
325
  ```
373
326
 
374
- ## Channels List
327
+ </details>
328
+
329
+ <details>
330
+ <summary>example.com.channels.xml</summary>
331
+ <br>
332
+
333
+ This file contains a list of channels available at the source.
375
334
 
376
335
  ```xml
377
336
  <?xml version="1.0" ?>
@@ -395,6 +354,29 @@ You can also specify the language, site, url, logo and LCN (Logical Channel Numb
395
354
  >France 24</channel>
396
355
  ```
397
356
 
357
+ </details>
358
+
359
+ After that, you just need to run the grabber with path to the config file:
360
+
361
+ ```sh
362
+ epg-grabber --config=path/to/example.com.config.js
363
+ ```
364
+
365
+ And when the download is complete, a ready-to-use guide will appear in the location you specified:
366
+
367
+ ```xml
368
+ <tv>
369
+ <channel id="CNN.us">
370
+ <display-name>CNN</display-name>
371
+ <url>https://example.com</url>
372
+ </channel>
373
+ <programme start="20211116040000 +0000" stop="20211116050000 +0000" channel="CNN.us">
374
+ <title lang="en">News at 10PM</title>
375
+ </programme>
376
+ // ...
377
+ </tv>
378
+ ```
379
+
398
380
  ## How to use SOCKS proxy?
399
381
 
400
382
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epg-grabber",
3
- "version": "0.46.1",
3
+ "version": "0.46.2",
4
4
  "description": "Node.js CLI tool for grabbing EPG from different sites",
5
5
  "homepage": "https://github.com/freearhey/epg-grabber",
6
6
  "preferGlobal": true,
@@ -34,7 +34,7 @@
34
34
  "url": "https://github.com/freearhey/epg-grabber.git"
35
35
  },
36
36
  "engines": {
37
- "node": ">=22.12.0"
37
+ "node": ">=20.20.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "@freearhey/core": "^0.14.0",
@@ -70,5 +70,8 @@
70
70
  "typescript": "^5.9.2",
71
71
  "typescript-eslint": "^8.44.1",
72
72
  "vitest": "^3.2.4"
73
+ },
74
+ "overrides": {
75
+ "esbuild": "0.23.1"
73
76
  }
74
77
  }
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" ?><tv date="20251028">
2
- <channel id="3TV.com"><display-name>3 TV</display-name><icon src="http://example.com/logos/1TV.png?x=шеллы&amp;sid=777"/><url>https://example2.com</url></channel>
3
- <channel id="4TV.com"><display-name>4 TV</display-name><icon src="http://example.com/logos/1TV.png?x=шеллы&amp;sid=777"/><url>https://example2.com</url></channel>
4
- <channel id="1TV.com"><display-name>1 TV</display-name><icon src="https://example.com/logos/1TV.png"/><url>https://example.com</url></channel>
5
- <channel id="2TV.com"><display-name>2 TV</display-name><icon src="http://example.com/logos/1TV.png?x=шеллы&amp;sid=777"/><url>https://example.com</url></channel>
6
- <programme start="20220101000000 +0000" stop="20220101010000 +0000" channel="3TV.com"><title>Program1</title></programme>
7
- <programme start="20220101000000 +0000" stop="20220101010000 +0000" channel="3TV.com"><title>Program1</title></programme>
8
- <programme start="20220101000000 +0000" stop="20220101010000 +0000" channel="2TV.com"><title>Program1</title></programme>
9
- <programme start="20220101000000 +0000" stop="20220101010000 +0000" channel="2TV.com"><title>Program1</title></programme>
10
- <programme start="20220101000000 +0000" stop="20220101010000 +0000" channel="1TV.com"><title lang="fr">Program1</title></programme>
11
- <programme start="20220101000000 +0000" stop="20220101010000 +0000" channel="1TV.com"><title lang="fr">Program1</title></programme>
12
- <programme start="20220101000000 +0000" stop="20220101010000 +0000" channel="4TV.com"><title>Program1</title></programme>
13
- <programme start="20220101000000 +0000" stop="20220101010000 +0000" channel="4TV.com"><title>Program1</title></programme>
14
- </tv>