@ormoshe/js-video-url-parser 0.5.13 → 0.5.14

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.
@@ -1791,9 +1791,15 @@
1791
1791
 
1792
1792
  Groove.prototype.parse = function(url, params) {
1793
1793
  var match = url.match(
1794
- /(?:videopage)\/([\w-]+)\/([\w-]+)/i
1794
+ /(?:play|embed)\/([\w-]+)\/([\w-]+)/i
1795
1795
  );
1796
- return match ? match[1] + '/' + match[2] : undefined;
1796
+ var result = {
1797
+ mediaType: this.mediaTypes.VIDEO,
1798
+ params: params,
1799
+ library: match[1],
1800
+ id: match[2]
1801
+ };
1802
+ return result.id ? result : undefined;
1797
1803
  };
1798
1804
 
1799
1805
  Groove.prototype.createUrl = function(baseUrl, vi, params) {
@@ -1801,8 +1807,8 @@
1801
1807
  return undefined;
1802
1808
  }
1803
1809
 
1804
- var url = baseUrl + vi.id + '/preview';
1805
- url += combineParams$k(params);
1810
+ var url = baseUrl + vi.library + '/' + vi.id;
1811
+ url += combineParams(params);
1806
1812
  return url;
1807
1813
  };
1808
1814
 
@@ -13,18 +13,15 @@ function Groove() {
13
13
 
14
14
  module.exports = Groove;
15
15
 
16
- Groove.prototype.parseUrl = function(url) {
16
+ Groove.prototype.parse = function(url, params) {
17
17
  var match = url.match(
18
- /(?:videopage)\/([\w-]+)\/([\w-]+)/i
18
+ /(?:play|embed)\/([\w-]+)\/([\w-]+)/i
19
19
  );
20
- return match ? match[1] + '/' + match[2] : undefined;
21
- };
22
-
23
- Groove.prototype.parse = function(url, params) {
24
20
  var result = {
25
21
  mediaType: this.mediaTypes.VIDEO,
26
22
  params: params,
27
- id: this.parseUrl(url)
23
+ library: match[1],
24
+ id: match[2]
28
25
  };
29
26
  return result.id ? result : undefined;
30
27
  };
@@ -34,7 +31,7 @@ Groove.prototype.createUrl = function(baseUrl, vi, params) {
34
31
  return undefined;
35
32
  }
36
33
 
37
- var url = baseUrl + vi.id;
34
+ var url = baseUrl + vi.library + '/' + vi.id;
38
35
  url += combineParams(params);
39
36
  return url;
40
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ormoshe/js-video-url-parser",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
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",