iptv-checker 0.24.3 → 0.25.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/errors.md CHANGED
@@ -46,7 +46,6 @@
46
46
  | HTTP_CONNECTION_REFUSED | HTTP Connection Refused |
47
47
  | HTTP_CANNOT_ASSIGN_REQUESTED_ADDRESS | HTTP Cannot Assign Requested Address |
48
48
  | HTTP_4XX_CLIENT_ERROR | HTTP 4XX Client Error |
49
- | HTTP_MAX_CONTENT_LENGTH_EXCEEDED | HTTP Max Content Length Exceeded |
50
49
  | HTTP_UNDEFINED | HTTP Undefined Error |
51
50
  | FFMPEG_INPUT_OUTPUT_ERROR | FFMPEG Input/output Error |
52
51
  | FFMPEG_PROTOCOL_NOT_FOUND | FFMPEG Protocol Not Found |
package/README.md CHANGED
@@ -38,7 +38,7 @@ Arguments:
38
38
  - `-k, --insecure`: allow insecure connections when using SSL
39
39
  - `-p, --parallel`: Batch size of channels to check concurrently (default to 1)
40
40
 
41
- ### Node.js
41
+ ### Module
42
42
 
43
43
  ```sh
44
44
  npm install iptv-checker
@@ -79,8 +79,6 @@ _On success:_
79
79
  tvg: {
80
80
  id: 'KBSVAssyriaSat.us',
81
81
  name: '',
82
- language: 'Assyrian Neo-Aramaic;English',
83
- country: 'US',
84
82
  logo: 'https://i.imgur.com/zEWSSdf.jpg',
85
83
  url: '',
86
84
  rec: ''
@@ -93,7 +91,7 @@ _On success:_
93
91
  'user-agent': ''
94
92
  },
95
93
  url: 'http://66.242.170.53/hls/live/temp/index.m3u8',
96
- raw: '#EXTINF:-1 tvg-id="KBSVAssyriaSat.us" tvg-country="US" tvg-language="Assyrian Neo-Aramaic;English" tvg-logo="https://i.imgur.com/zEWSSdf.jpg" group-title="General",KBSV/AssyriaSat (720p) [Not 24/7]\r\nhttp://66.242.170.53/hls/live/temp/index.m3u8',
94
+ raw: '#EXTINF:-1 tvg-id="KBSVAssyriaSat.us" tvg-logo="https://i.imgur.com/zEWSSdf.jpg" group-title="General",KBSV/AssyriaSat (720p) [Not 24/7]\r\nhttp://66.242.170.53/hls/live/temp/index.m3u8',
97
95
  line: 2,
98
96
  catchup: {
99
97
  type: '',
@@ -198,8 +196,6 @@ _On error:_
198
196
  tvg: {
199
197
  id: 'AddisTV.et',
200
198
  name: '',
201
- language: 'Amharic',
202
- country: 'ET',
203
199
  logo: 'https://i.imgur.com/KAg6MOI.png',
204
200
  url: '',
205
201
  rec: ''
@@ -212,7 +208,7 @@ _On error:_
212
208
  'user-agent': ''
213
209
  },
214
210
  url: 'https://rrsatrtmp.tulix.tv/addis1/addis1multi.smil/playlist.m3u8',
215
- raw: '#EXTINF:-1 tvg-id="AddisTV.et" tvg-country="ET" tvg-language="Amharic" tvg-logo="https://i.imgur.com/KAg6MOI.png" group-title="Undefined",Addis TV (720p)\\r\\nhttps://rrsatrtmp.tulix.tv/addis1/addis1multi.smil/playlist.m3u8',
211
+ raw: '#EXTINF:-1 tvg-id="AddisTV.et" tvg-logo="https://i.imgur.com/KAg6MOI.png" group-title="Undefined",Addis TV (720p)\\r\\nhttps://rrsatrtmp.tulix.tv/addis1/addis1multi.smil/playlist.m3u8',
216
212
  line: 2,
217
213
  catchup: {
218
214
  type: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iptv-checker",
3
- "version": "0.24.3",
3
+ "version": "0.25.0",
4
4
  "description": "Node.js CLI tool for checking links in IPTV playlists",
5
5
  "main": "src/index.js",
6
6
  "preferGlobal": true,
@@ -37,7 +37,7 @@
37
37
  "commander": "^2.20.0",
38
38
  "dateformat": "^3.0.3",
39
39
  "get-stdin": "^7.0.0",
40
- "iptv-playlist-parser": "^0.11.0",
40
+ "iptv-playlist-parser": "^0.12.0",
41
41
  "jest": "^27.0.6",
42
42
  "lodash.chunk": "^4.2.0",
43
43
  "progress": "^2.0.3",
package/src/errors.js CHANGED
@@ -51,7 +51,6 @@ module.exports = {
51
51
  HTTP_CONNECTION_REFUSED: 'HTTP Connection Refused',
52
52
  HTTP_CANNOT_ASSIGN_REQUESTED_ADDRESS: 'HTTP Cannot Assign Requested Address',
53
53
  HTTP_4XX_CLIENT_ERROR: 'HTTP 4XX Client Error',
54
- HTTP_MAX_CONTENT_LENGTH_EXCEEDED: 'HTTP Max Content Length Exceeded',
55
54
  HTTP_UNDEFINED: 'HTTP Undefined Error',
56
55
 
57
56
  FFMPEG_INPUT_OUTPUT_ERROR: 'FFMPEG Input/output Error',
package/src/http.js CHANGED
@@ -2,6 +2,7 @@ const curlirize = require('axios-curlirize')
2
2
  const axios = require('axios')
3
3
  const https = require('https')
4
4
  const errors = require('./errors')
5
+ const CancelToken = axios.CancelToken
5
6
 
6
7
  module.exports.loadPlaylist = loadPlaylist
7
8
  module.exports.loadStream = loadStream
@@ -32,6 +33,7 @@ playlistClient.interceptors.response.use(
32
33
  const streamClient = axios.create({
33
34
  method: 'GET',
34
35
  timeout: 60000,
36
+ maxContentLength: 100 * 1024,
35
37
  httpsAgent: new https.Agent({
36
38
  rejectUnauthorized: false,
37
39
  }),
@@ -59,7 +61,6 @@ function loadStream(item, config, logger) {
59
61
  const referer =
60
62
  item.http && item.http.referrer ? item.http.referrer : config.httpReferer
61
63
  const timeout = item.timeout || config.timeout
62
- const maxContentLength = item.maxContentLength || config.maxContentLength
63
64
 
64
65
  const headers = {}
65
66
  if (userAgent) {
@@ -69,15 +70,23 @@ function loadStream(item, config, logger) {
69
70
  headers['Referer'] = referer
70
71
  }
71
72
 
73
+ let source = CancelToken.source()
74
+ setTimeout(() => {
75
+ source.cancel('timeout')
76
+ }, timeout)
77
+
72
78
  return streamClient(item.url, {
73
79
  timeout,
74
- maxContentLength,
75
80
  headers,
81
+ cancelToken: source.token,
76
82
  curlirize: config.debug,
77
83
  })
78
84
  .then(() => Promise.resolve())
79
85
  .catch(err => {
80
86
  const code = parseError(err, config, logger)
87
+ if (code === 'HTTP_MAX_CONTENT_LENGTH_EXCEEDED') {
88
+ return Promise.resolve()
89
+ }
81
90
 
82
91
  return Promise.reject({
83
92
  ok: false,
package/src/index.js CHANGED
@@ -13,7 +13,6 @@ const defaultConfig = {
13
13
  debug: false,
14
14
  userAgent: null,
15
15
  timeout: 60000,
16
- maxContentLength: 5 * 1024 * 1024,
17
16
  parallel: cpus.length,
18
17
  setUp: playlist => {}, // eslint-disable-line
19
18
  afterEach: item => {}, // eslint-disable-line
@@ -29,10 +29,9 @@ test(`Should process a playlist URL`, done => {
29
29
  })
30
30
 
31
31
  test(`Should process a stream URL`, done => {
32
- const url =
33
- 'http://cdn.theoplayer.com/video/elephants-dream/playlist-single-audio.m3u8'
32
+ const url = 'https://live-hls-web-aja.getaj.net/AJA/index.m3u8'
34
33
  checker
35
- .checkStream({ url, timeout: 5000 })
34
+ .checkStream({ url, timeout: 10000 })
36
35
  .then(results => {
37
36
  expect(results.status.ok).toBeTruthy()
38
37
  done()
@@ -139,14 +138,14 @@ test(`Should handle HTTP_FORBIDDEN`, done => {
139
138
  .catch(done)
140
139
  })
141
140
 
142
- test(`Should handle HTTP_MAX_CONTENT_LENGTH_EXCEEDED`, done => {
141
+ test(`Should use timeout parameter`, done => {
143
142
  const url =
144
- 'https://artesimulcast.akamaized.net/hls/live/2030993/artelive_de/index.m3u8'
143
+ 'http://hbbtvlive.v3.tvp.pl/hbbtvlive/livestream.php?app_id=tvpbialystok'
145
144
  checker
146
- .checkStream({ url, timeout: 2000, maxContentLength: 100 })
145
+ .checkStream({ url, timeout: 100 })
147
146
  .then(results => {
148
- expect(results.status.code).toBe('HTTP_MAX_CONTENT_LENGTH_EXCEEDED')
149
- expect(results.status.message).toBe('HTTP Max Content Length Exceeded')
147
+ expect(results.status.code).toBe('HTTP_REQUEST_TIMEOUT')
148
+ expect(results.status.message).toBe('HTTP 408 Request Timeout')
150
149
  done()
151
150
  })
152
151
  .catch(done)