@ormoshe/js-video-url-parser 0.5.22 → 0.5.24

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.
@@ -1941,6 +1941,48 @@
1941
1941
 
1942
1942
  base.bind(new Searchie());
1943
1943
 
1944
+ var combineParams$o = util.combineParams;
1945
+
1946
+ function Tevello() {
1947
+ this.provider = 'tevello';
1948
+ this.defaultFormat = 'long';
1949
+ this.formats = {
1950
+ long: this.createLongUrl,
1951
+ };
1952
+ this.mediaTypes = {
1953
+ VIDEO: 'video',
1954
+ };
1955
+ }
1956
+
1957
+ Tevello.prototype.parse = function(url, params) {
1958
+ var match = url.match(
1959
+ /(?:play|embed)\/([a-zA-Z\d]+)\/([\w-]+)/i
1960
+ );
1961
+ var result = {
1962
+ mediaType: this.mediaTypes.VIDEO,
1963
+ params: params,
1964
+ library: match[1],
1965
+ id: match[2]
1966
+ };
1967
+ return result.id ? result : undefined;
1968
+ };
1969
+
1970
+ Tevello.prototype.createUrl = function(baseUrl, vi, params) {
1971
+ if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
1972
+ return undefined;
1973
+ }
1974
+
1975
+ var url = baseUrl + vi.library + '/' + vi.id;
1976
+ url += combineParams$o(params);
1977
+ return url;
1978
+ };
1979
+
1980
+ Tevello.prototype.createLongUrl = function(vi, params) {
1981
+ return this.createUrl('https://video.tevello.com/play/', vi, params);
1982
+ };
1983
+
1984
+ base.bind(new Tevello());
1985
+
1944
1986
  var lib = base;
1945
1987
 
1946
1988
  return lib;
@@ -0,0 +1,14 @@
1
+ import { VideoInfo } from '../urlParser';
2
+
3
+ export interface TevelloUrlParameters {
4
+ [key: string]: any;
5
+ }
6
+
7
+ export type TevelloMediaTypes = 'video';
8
+
9
+ export interface TevelloVideoInfo extends VideoInfo<TevelloUrlParameters, TevelloMediaTypes> {
10
+ provider: 'tevello';
11
+ channel: string;
12
+ }
13
+
14
+ export type TevelloParseResult = TevelloVideoInfo | undefined;
@@ -0,0 +1,43 @@
1
+ const { combineParams } = require('../util');
2
+
3
+ function Tevello() {
4
+ this.provider = 'tevello';
5
+ this.defaultFormat = 'long';
6
+ this.formats = {
7
+ long: this.createLongUrl,
8
+ };
9
+ this.mediaTypes = {
10
+ VIDEO: 'video',
11
+ };
12
+ }
13
+
14
+ module.exports = Tevello;
15
+
16
+ Tevello.prototype.parse = function(url, params) {
17
+ var match = url.match(
18
+ /(?:play|embed)\/([a-zA-Z\d]+)\/([\w-]+)/i
19
+ );
20
+ var result = {
21
+ mediaType: this.mediaTypes.VIDEO,
22
+ params: params,
23
+ library: match[1],
24
+ id: match[2]
25
+ };
26
+ return result.id ? result : undefined;
27
+ };
28
+
29
+ Tevello.prototype.createUrl = function(baseUrl, vi, params) {
30
+ if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
31
+ return undefined;
32
+ }
33
+
34
+ var url = baseUrl + vi.library + '/' + vi.id;
35
+ url += combineParams(params);
36
+ return url;
37
+ };
38
+
39
+ Tevello.prototype.createLongUrl = function(vi, params) {
40
+ return this.createUrl('https://video.tevello.com/play/', vi, params);
41
+ };
42
+
43
+ require('../base').bind(new Tevello());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ormoshe/js-video-url-parser",
3
- "version": "0.5.22",
3
+ "version": "0.5.24",
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",