@warren-bank/hls-proxy 3.4.8 → 3.5.1
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 +8 -10
- package/hls-proxy/manifest_parser.js +5 -4
- package/hls-proxy/regexp_indices.js +50 -0
- package/hls-proxy/url.js +31 -0
- package/hls-proxy/utils.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -612,8 +612,8 @@ curl --silent --insecure "$URL"
|
|
|
612
612
|
- system requirements:
|
|
613
613
|
* Node.js version: v8.6.0 (and higher)
|
|
614
614
|
- transitive [dependency](https://github.com/warren-bank/HLS-Proxy/blob/v1.0.1/package.json#L13-L14) requirements:
|
|
615
|
-
*
|
|
616
|
-
*
|
|
615
|
+
* v08.06.00+: [`@warren-bank/node-process-argv`](https://github.com/warren-bank/node-process-argv#requirements)
|
|
616
|
+
* v08.06.00+: [`@warren-bank/node-request`](https://github.com/warren-bank/node-request#requirements)
|
|
617
617
|
* `v2.x`
|
|
618
618
|
- commit history is in branch: [`v02`](https://github.com/warren-bank/HLS-Proxy/commits/v02)
|
|
619
619
|
- summary:
|
|
@@ -625,8 +625,8 @@ curl --silent --insecure "$URL"
|
|
|
625
625
|
- system requirements:
|
|
626
626
|
* Node.js version: v8.6.0 (and higher)
|
|
627
627
|
- transitive [dependency](https://github.com/warren-bank/HLS-Proxy/blob/v2.0.3/package.json#L13-L14) requirements:
|
|
628
|
-
*
|
|
629
|
-
*
|
|
628
|
+
* v08.06.00+: [`@warren-bank/node-process-argv`](https://github.com/warren-bank/node-process-argv#requirements)
|
|
629
|
+
* v08.06.00+: [`@warren-bank/node-request`](https://github.com/warren-bank/node-request#requirements)
|
|
630
630
|
* `v3.x`
|
|
631
631
|
- commit history is in branch: [`v03`](https://github.com/warren-bank/HLS-Proxy/commits/v03)
|
|
632
632
|
- summary:
|
|
@@ -637,12 +637,10 @@ curl --silent --insecure "$URL"
|
|
|
637
637
|
* important requirement: the path for a custom route needs to include exactly one unnamed [parameter](https://expressjs.com/en/guide/routing.html#route-parameters) that matches the base64 encoded URL and (optionally) a file extension (ex: `'/proxy/*'`)
|
|
638
638
|
* the use of nested routers is supported
|
|
639
639
|
- system requirements:
|
|
640
|
-
* Node.js version:
|
|
641
|
-
- transitive [dependency](https://github.com/warren-bank/HLS-Proxy/blob/v3.
|
|
642
|
-
*
|
|
643
|
-
*
|
|
644
|
-
- [ES6 support](http://node.green/)
|
|
645
|
-
* v16.00.00+: [`RegExp` 'd' flag](https://node.green/#ES2022-features-RegExp-Match-Indices---hasIndices-----d--flag-)
|
|
640
|
+
* Node.js version: v8.6.0 (and higher)
|
|
641
|
+
- transitive [dependency](https://github.com/warren-bank/HLS-Proxy/blob/v3.5.1/package.json#L13-L14) requirements:
|
|
642
|
+
* v08.06.00+: [`@warren-bank/node-process-argv`](https://github.com/warren-bank/node-process-argv#requirements)
|
|
643
|
+
* v08.06.00+: [`@warren-bank/node-request`](https://github.com/warren-bank/node-request#requirements)
|
|
646
644
|
|
|
647
645
|
- - - -
|
|
648
646
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const regexp_indices = require('./regexp_indices')
|
|
2
|
+
const {URL} = require('./url')
|
|
3
|
+
const utils = require('./utils')
|
|
3
4
|
|
|
4
5
|
const regexs = {
|
|
5
6
|
vod_start_at: /#vod_start(?:_prefetch_at)?=((?:\d+:)?(?:\d+:)?\d+)$/i,
|
|
6
7
|
m3u8_line_separator: /\s*[\r\n]+\s*/,
|
|
7
8
|
m3u8_line_landmark: /^(#[^:]+[:]?)/,
|
|
8
|
-
m3u8_line_url: /URI=["']([^"']+)["']/
|
|
9
|
+
m3u8_line_url: regexp_indices.updateRegExp(/URI=["']([^"']+)["']/i)
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
const url_location_landmarks = {
|
|
@@ -170,7 +171,7 @@ const extract_embedded_urls = function(m3u8_lines, m3u8_url, referer_url, meta_d
|
|
|
170
171
|
if (meta_data !== null)
|
|
171
172
|
extract_meta_data(meta_data, m3u8_line, matching_landmark)
|
|
172
173
|
|
|
173
|
-
matches = regexs.m3u8_line_url
|
|
174
|
+
matches = regexp_indices.exec(regexs.m3u8_line_url, m3u8_line)
|
|
174
175
|
if (!matches) continue
|
|
175
176
|
matching_url = matches[1]
|
|
176
177
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require('regexp-match-indices/config').mode = 'spec-compliant'
|
|
2
|
+
|
|
3
|
+
const state = {
|
|
4
|
+
'native': require('regexp-match-indices/native'),
|
|
5
|
+
'polyfill': require('regexp-match-indices/implementation')
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const setExecImplementation = function() {
|
|
9
|
+
try {
|
|
10
|
+
const str = 'foo_bar_baz'
|
|
11
|
+
|
|
12
|
+
const regex = new RegExp(str, 'd')
|
|
13
|
+
if (!regex.hasIndices) throw ''
|
|
14
|
+
|
|
15
|
+
const match = regex.exec(str)
|
|
16
|
+
if (!(match.indices && (match.indices.length === 1) && (match.indices[0][0] === 0) && (match.indices[0][1] === str.length))) throw ''
|
|
17
|
+
|
|
18
|
+
state.implementation = state['native']
|
|
19
|
+
state.isNative = true
|
|
20
|
+
state.isPolyfill = false
|
|
21
|
+
}
|
|
22
|
+
catch(e) {
|
|
23
|
+
state.implementation = state['polyfill']
|
|
24
|
+
state.isNative = false
|
|
25
|
+
state.isPolyfill = true
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setExecImplementation()
|
|
30
|
+
|
|
31
|
+
const exec = function(regex, string) {
|
|
32
|
+
if (state.isNative)
|
|
33
|
+
regex = updateRegExp(regex)
|
|
34
|
+
|
|
35
|
+
return state.implementation.call(regex, string)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const updateRegExp = function(regex) {
|
|
39
|
+
return (state.isPolyfill || !state.isNative || regex.hasIndices)
|
|
40
|
+
? regex
|
|
41
|
+
: new RegExp(
|
|
42
|
+
regex.source,
|
|
43
|
+
((regex.flags || '') + 'd')
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = {
|
|
48
|
+
exec,
|
|
49
|
+
updateRegExp
|
|
50
|
+
}
|
package/hls-proxy/url.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
let parse, URL
|
|
2
|
+
|
|
3
|
+
if (!parse || !URL) {
|
|
4
|
+
try {
|
|
5
|
+
({parse, URL} = require('@warren-bank/url/es6-node/jsURL'));
|
|
6
|
+
}
|
|
7
|
+
catch(e){}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (!parse || !URL) {
|
|
11
|
+
try {
|
|
12
|
+
({parse, URL} = require('@warren-bank/url/es5-browser/jsURL'));
|
|
13
|
+
}
|
|
14
|
+
catch(e){}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!parse || !URL) {
|
|
18
|
+
try {
|
|
19
|
+
({parse, URL} = require('url'));
|
|
20
|
+
}
|
|
21
|
+
catch(e){}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!parse || !URL) {
|
|
25
|
+
throw new Error('URL class is not supported')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
parse,
|
|
30
|
+
URL
|
|
31
|
+
}
|
package/hls-proxy/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warren-bank/hls-proxy",
|
|
3
3
|
"description": "Node.js server to proxy HLS video streams",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.1",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node hls-proxy/bin/hlsd.js",
|
|
7
7
|
"sudo": "sudo node hls-proxy/bin/hlsd.js"
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"@warren-bank/node-request": "^2.0.12",
|
|
15
15
|
"@warren-bank/url": "^3.1.2",
|
|
16
16
|
"hpagent": "^1.2.0",
|
|
17
|
+
"regexp-match-indices": "^1.0.2",
|
|
17
18
|
"tough-cookie": "^3.0.1"
|
|
18
19
|
},
|
|
19
20
|
"license": "GPL-2.0",
|