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

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.
@@ -1739,7 +1739,7 @@
1739
1739
 
1740
1740
  var combineParams$j = util.combineParams;
1741
1741
 
1742
- function Canva() {
1742
+ function Google() {
1743
1743
  this.provider = 'google';
1744
1744
  this.defaultFormat = 'long';
1745
1745
  this.formats = {
@@ -1750,7 +1750,7 @@
1750
1750
  };
1751
1751
  }
1752
1752
 
1753
- Canva.prototype.parse = function(url, params) {
1753
+ Google.prototype.parse = function(url, params) {
1754
1754
  var match = url.match(/\/d\/([\w-]+)/);
1755
1755
  var result = {
1756
1756
  mediaType: this.mediaTypes.VIDEO,
@@ -1760,7 +1760,7 @@
1760
1760
  return result.id ? result : undefined;
1761
1761
  };
1762
1762
 
1763
- Canva.prototype.createUrl = function(baseUrl, vi, params) {
1763
+ Google.prototype.createUrl = function(baseUrl, vi, params) {
1764
1764
  if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
1765
1765
  return undefined;
1766
1766
  }
@@ -1770,11 +1770,47 @@
1770
1770
  return url;
1771
1771
  };
1772
1772
 
1773
- Canva.prototype.createLongUrl = function(vi, params) {
1773
+ Google.prototype.createLongUrl = function(vi, params) {
1774
1774
  return this.createUrl('https://drive.google.com/file/d/', vi, params);
1775
1775
  };
1776
1776
 
1777
- base.bind(new Canva());
1777
+ base.bind(new Google());
1778
+
1779
+ var combineParams$k = util.combineParams;
1780
+
1781
+ function Groove() {
1782
+ this.provider = 'groove';
1783
+ this.defaultFormat = 'long';
1784
+ this.formats = {
1785
+ long: this.createLongUrl,
1786
+ };
1787
+ this.mediaTypes = {
1788
+ VIDEO: 'video',
1789
+ };
1790
+ }
1791
+
1792
+ Groove.prototype.parse = function(url, params) {
1793
+ var match = url.match(
1794
+ /(?:videopage)\/([\w-]+)\/([\w-]+)/i
1795
+ );
1796
+ return match ? match[1] + '/' + match[2] : undefined;
1797
+ };
1798
+
1799
+ Groove.prototype.createUrl = function(baseUrl, vi, params) {
1800
+ if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
1801
+ return undefined;
1802
+ }
1803
+
1804
+ var url = baseUrl + vi.id + '/preview';
1805
+ url += combineParams$k(params);
1806
+ return url;
1807
+ };
1808
+
1809
+ Groove.prototype.createLongUrl = function(vi, params) {
1810
+ return this.createUrl('https://app.groove.cm/groovevideo/videopage/', vi, params);
1811
+ };
1812
+
1813
+ base.bind(new Groove());
1778
1814
 
1779
1815
  var lib = base;
1780
1816
 
@@ -0,0 +1,46 @@
1
+ const { combineParams } = require('../util');
2
+
3
+ function Groove() {
4
+ this.provider = 'groove';
5
+ this.defaultFormat = 'long';
6
+ this.formats = {
7
+ long: this.createLongUrl,
8
+ };
9
+ this.mediaTypes = {
10
+ VIDEO: 'video',
11
+ };
12
+ }
13
+
14
+ module.exports = Groove;
15
+
16
+ Groove.prototype.parseUrl = function(url) {
17
+ var match = url.match(
18
+ /(?:videopage)\/([\w-]+)\/([\w-]+)/i
19
+ );
20
+ return match ? match[1] + '/' + match[2] : undefined;
21
+ };
22
+
23
+ Groove.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
+ Groove.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
+ Groove.prototype.createLongUrl = function(vi, params) {
43
+ return this.createUrl('https://app.groove.cm/groovevideo/videopage/', vi, params);
44
+ };
45
+
46
+ require('../base').bind(new Groove());
@@ -0,0 +1,14 @@
1
+ import { VideoInfo } from '../urlParser';
2
+
3
+ export interface GrooveUrlParameters {
4
+ [key: string]: any;
5
+ }
6
+
7
+ export type GrooveMediaTypes = 'video';
8
+
9
+ export interface GrooveVideoInfo extends VideoInfo<GrooveUrlParameters, GrooveMediaTypes> {
10
+ provider: 'groove';
11
+ channel: string;
12
+ }
13
+
14
+ export type VoomlyParseResult = GrooveVideoInfo | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ormoshe/js-video-url-parser",
3
- "version": "0.5.12",
3
+ "version": "0.5.13",
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",