@ormoshe/js-video-url-parser 0.5.2 → 0.5.4
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/dist/jsVideoUrlParser.js +53 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +1 -0
- package/lib/provider/spotlightr.d.ts +14 -0
- package/lib/provider/spotlightr.js +46 -0
- package/lib/provider/voomly.js +1 -1
- package/package.json +1 -1
package/dist/jsVideoUrlParser.js
CHANGED
|
@@ -1577,11 +1577,18 @@
|
|
|
1577
1577
|
};
|
|
1578
1578
|
}
|
|
1579
1579
|
|
|
1580
|
+
Voomly.prototype.parseUrl = function(url) {
|
|
1581
|
+
var match = url.match(
|
|
1582
|
+
/(?:v|embed)\/([a-zA-Z\d]+)/i
|
|
1583
|
+
);
|
|
1584
|
+
return match ? match[1] : undefined;
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1580
1587
|
Voomly.prototype.parse = function(url, params) {
|
|
1581
1588
|
var result = {
|
|
1582
1589
|
mediaType: this.mediaTypes.VIDEO,
|
|
1583
1590
|
params: params,
|
|
1584
|
-
id: this.parseUrl(url)
|
|
1591
|
+
id: this.parseUrl(url)
|
|
1585
1592
|
};
|
|
1586
1593
|
return result.id ? result : undefined;
|
|
1587
1594
|
};
|
|
@@ -1602,6 +1609,51 @@
|
|
|
1602
1609
|
|
|
1603
1610
|
base.bind(new Voomly());
|
|
1604
1611
|
|
|
1612
|
+
var combineParams$g = util.combineParams;
|
|
1613
|
+
|
|
1614
|
+
function Spotlightr() {
|
|
1615
|
+
this.provider = 'spotlightr';
|
|
1616
|
+
this.defaultFormat = 'long';
|
|
1617
|
+
this.formats = {
|
|
1618
|
+
long: this.createLongUrl,
|
|
1619
|
+
};
|
|
1620
|
+
this.mediaTypes = {
|
|
1621
|
+
VIDEO: 'video',
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
Spotlightr.prototype.parseUrl = function(url) {
|
|
1626
|
+
var match = url.match(
|
|
1627
|
+
/(?:watch)\/([a-zA-Z\d]+)/i
|
|
1628
|
+
);
|
|
1629
|
+
return match ? match[1] : undefined;
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
Spotlightr.prototype.parse = function(url, params) {
|
|
1633
|
+
var result = {
|
|
1634
|
+
mediaType: this.mediaTypes.VIDEO,
|
|
1635
|
+
params: params,
|
|
1636
|
+
id: this.parseUrl(url)
|
|
1637
|
+
};
|
|
1638
|
+
return result.id ? result : undefined;
|
|
1639
|
+
};
|
|
1640
|
+
|
|
1641
|
+
Spotlightr.prototype.createUrl = function(baseUrl, vi, params) {
|
|
1642
|
+
if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
|
|
1643
|
+
return undefined;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
var url = baseUrl + vi.id;
|
|
1647
|
+
url += combineParams$g(params);
|
|
1648
|
+
return url;
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
Spotlightr.prototype.createLongUrl = function(vi, params) {
|
|
1652
|
+
return this.createUrl('https://videos.cdn.spotlightr.com/watch/', vi, params);
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1655
|
+
base.bind(new Spotlightr());
|
|
1656
|
+
|
|
1605
1657
|
var lib = base;
|
|
1606
1658
|
|
|
1607
1659
|
return lib;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -13,6 +13,7 @@ require('./provider/soundcloud');
|
|
|
13
13
|
require('./provider/teachertube');
|
|
14
14
|
require('./provider/tiktok');
|
|
15
15
|
require('./provider/voomly');
|
|
16
|
+
require('./provider/spotlightr');
|
|
16
17
|
require('./provider/ted');
|
|
17
18
|
require('./provider/facebook');
|
|
18
19
|
module.exports = parser;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VideoInfo } from '../urlParser';
|
|
2
|
+
|
|
3
|
+
export interface SpotlightrUrlParameters {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type SpotlightrMediaTypes = 'video';
|
|
8
|
+
|
|
9
|
+
export interface SpotlightrVideoInfo extends VideoInfo<SpotlightrUrlParameters, SpotlightrMediaTypes> {
|
|
10
|
+
provider: 'spotlightr';
|
|
11
|
+
channel: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type SpotlightrParseResult = SpotlightrVideoInfo | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const { combineParams } = require('../util');
|
|
2
|
+
|
|
3
|
+
function Spotlightr() {
|
|
4
|
+
this.provider = 'spotlightr';
|
|
5
|
+
this.defaultFormat = 'long';
|
|
6
|
+
this.formats = {
|
|
7
|
+
long: this.createLongUrl,
|
|
8
|
+
};
|
|
9
|
+
this.mediaTypes = {
|
|
10
|
+
VIDEO: 'video',
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = Spotlightr;
|
|
15
|
+
|
|
16
|
+
Spotlightr.prototype.parseUrl = function(url) {
|
|
17
|
+
var match = url.match(
|
|
18
|
+
/(?:watch)\/([a-zA-Z\d]+)/i
|
|
19
|
+
);
|
|
20
|
+
return match ? match[1] : undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Spotlightr.prototype.parse = function(url, params) {
|
|
24
|
+
var result = {
|
|
25
|
+
mediaType: this.mediaTypes.VIDEO,
|
|
26
|
+
params: params,
|
|
27
|
+
id: this.parseUrl(url)
|
|
28
|
+
};
|
|
29
|
+
return result.id ? result : undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
Spotlightr.prototype.createUrl = function(baseUrl, vi, params) {
|
|
33
|
+
if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var url = baseUrl + vi.id;
|
|
38
|
+
url += combineParams(params);
|
|
39
|
+
return url;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
Spotlightr.prototype.createLongUrl = function(vi, params) {
|
|
43
|
+
return this.createUrl('https://videos.cdn.spotlightr.com/watch/', vi, params);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
require('../base').bind(new Spotlightr());
|
package/lib/provider/voomly.js
CHANGED
package/package.json
CHANGED