@ormoshe/js-video-url-parser 0.5.31 → 0.5.32

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.
@@ -0,0 +1,13 @@
1
+ import { VideoInfo } from '../urlParser';
2
+
3
+ export interface TellaUrlParameters {
4
+ [key: string]: any;
5
+ }
6
+
7
+ export type TellaMediaTypes = 'video';
8
+
9
+ export interface TellaVideoInfo extends VideoInfo<TellaUrlParameters, TellaMediaTypes> {
10
+ provider: 'tella';
11
+ }
12
+
13
+ export type TellaParseResult = TellaVideoInfo | undefined;
@@ -0,0 +1,51 @@
1
+ const { combineParams } = require('../util');
2
+
3
+ function Tella() {
4
+ this.provider = 'tella';
5
+ this.defaultFormat = 'long';
6
+ this.formats = {
7
+ long: this.createLongUrl,
8
+ embed: this.createEmbedUrl,
9
+ };
10
+ this.mediaTypes = {
11
+ VIDEO: 'video',
12
+ };
13
+ }
14
+
15
+ module.exports = Tella;
16
+
17
+ Tella.prototype.parseUrl = function(url) {
18
+ var match = url.match(
19
+ /(?:video)\/([\w-]+)/i
20
+ );
21
+ return match ? match[1] : undefined;
22
+ };
23
+
24
+ Tella.prototype.parse = function(url, params) {
25
+ var result = {
26
+ mediaType: this.mediaTypes.VIDEO,
27
+ params: params,
28
+ id: this.parseUrl(url),
29
+ };
30
+ return result.id ? result : undefined;
31
+ };
32
+
33
+ Tella.prototype.createUrl = function(baseUrl, vi, params) {
34
+ if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
35
+ return undefined;
36
+ }
37
+
38
+ var url = baseUrl + vi.id;
39
+ url += combineParams(params);
40
+ return url;
41
+ };
42
+
43
+ Tella.prototype.createLongUrl = function(vi, params) {
44
+ return this.createUrl('https://www.tella.tv/video/', vi, params);
45
+ };
46
+
47
+ Tella.prototype.createEmbedUrl = function(vi, params) {
48
+ return this.createUrl('https://www.tella.tv/video/', vi, params);
49
+ };
50
+
51
+ require('../base').bind(new Tella());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ormoshe/js-video-url-parser",
3
- "version": "0.5.31",
3
+ "version": "0.5.32",
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",