@ormoshe/js-video-url-parser 0.5.1 → 0.5.3

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.
@@ -1564,6 +1564,51 @@
1564
1564
 
1565
1565
  base.bind(new Facebook());
1566
1566
 
1567
+ var combineParams$f = util.combineParams;
1568
+
1569
+ function Voomly() {
1570
+ this.provider = 'voomly';
1571
+ this.defaultFormat = 'long';
1572
+ this.formats = {
1573
+ long: this.createLongUrl,
1574
+ };
1575
+ this.mediaTypes = {
1576
+ VIDEO: 'video',
1577
+ };
1578
+ }
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
+
1587
+ Voomly.prototype.parse = function(url, params) {
1588
+ var result = {
1589
+ mediaType: this.mediaTypes.VIDEO,
1590
+ params: params,
1591
+ id: this.parseUrl(url)
1592
+ };
1593
+ return result.id ? result : undefined;
1594
+ };
1595
+
1596
+ Voomly.prototype.createUrl = function(baseUrl, vi, params) {
1597
+ if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
1598
+ return undefined;
1599
+ }
1600
+
1601
+ var url = baseUrl + vi.id;
1602
+ url += combineParams$f(params);
1603
+ return url;
1604
+ };
1605
+
1606
+ Voomly.prototype.createLongUrl = function(vi, params) {
1607
+ return this.createUrl('https://share.voomly.com/v/', vi, params);
1608
+ };
1609
+
1610
+ base.bind(new Voomly());
1611
+
1567
1612
  var lib = base;
1568
1613
 
1569
1614
  return lib;
package/lib/index.d.ts CHANGED
@@ -15,3 +15,4 @@ export * from './provider/youku';
15
15
  export * from './provider/youtube';
16
16
  export * from './provider/ted';
17
17
  export * from './provider/tiktok';
18
+ export * from './provider/voomly';
@@ -24,7 +24,7 @@ Voomly.prototype.parse = function(url, params) {
24
24
  var result = {
25
25
  mediaType: this.mediaTypes.VIDEO,
26
26
  params: params,
27
- id: this.parseUrl(url),
27
+ id: this.parseUrl(url)
28
28
  };
29
29
  return result.id ? result : undefined;
30
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ormoshe/js-video-url-parser",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "A parser to extract provider, video id, starttime and others from YouTube, Vimeo, ... urls",
5
5
  "main": "lib/index.js",
6
6
  "browser": "dist/jsVideoUrlParser.js",