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

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.
@@ -1900,6 +1900,47 @@
1900
1900
 
1901
1901
  base.bind(new Bigcommand());
1902
1902
 
1903
+ var combineParams$n = util.combineParams;
1904
+
1905
+ function Searchie() {
1906
+ this.provider = 'searchie';
1907
+ this.defaultFormat = 'long';
1908
+ this.formats = {
1909
+ long: this.createLongUrl,
1910
+ };
1911
+ this.mediaTypes = {
1912
+ VIDEO: 'video',
1913
+ };
1914
+ }
1915
+
1916
+ Searchie.prototype.parse = function(url, params) {
1917
+ var match = url.match(
1918
+ /(?:watch)\/([\w-]+)/i
1919
+ );
1920
+ var result = {
1921
+ mediaType: this.mediaTypes.VIDEO,
1922
+ params: params,
1923
+ id: match[1]
1924
+ };
1925
+ return result.id ? result : undefined;
1926
+ };
1927
+
1928
+ Searchie.prototype.createUrl = function(baseUrl, vi, params) {
1929
+ if (!vi.id || vi.mediaType !== this.mediaTypes.VIDEO) {
1930
+ return undefined;
1931
+ }
1932
+
1933
+ var url = baseUrl + vi.library + '/' + vi.id;
1934
+ url += combineParams$n(params);
1935
+ return url;
1936
+ };
1937
+
1938
+ Searchie.prototype.createLongUrl = function(vi, params) {
1939
+ return this.createUrl('https://app.searchie.io/watch/', vi, params);
1940
+ };
1941
+
1942
+ base.bind(new Searchie());
1943
+
1903
1944
  var lib = base;
1904
1945
 
1905
1946
  return lib;
@@ -0,0 +1,46 @@
1
+ const { combineParams } = require('../util');
2
+
3
+ function Searchie() {
4
+ this.provider = 'searchie';
5
+ this.defaultFormat = 'long';
6
+ this.formats = {
7
+ long: this.createLongUrl,
8
+ };
9
+ this.mediaTypes = {
10
+ VIDEO: 'video',
11
+ };
12
+ }
13
+
14
+ module.exports = Searchie;
15
+
16
+ Searchie.prototype.parseUrl = function(url) {
17
+ var match = url.match(
18
+ /(?:watch)\/([\w-]+)/i
19
+ );
20
+ return match ? match[1] : undefined;
21
+ };
22
+
23
+ Searchie.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
+ Searchie.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
+ Searchie.prototype.createLongUrl = function(vi, params) {
43
+ return this.createUrl('https://app.searchie.io/watch/', vi, params);
44
+ };
45
+
46
+ require('../base').bind(new GoogleDrive());
@@ -0,0 +1,14 @@
1
+ import { VideoInfo } from '../urlParser';
2
+
3
+ export interface SearchieUrlParameters {
4
+ [key: string]: any;
5
+ }
6
+
7
+ export type SearchieMediaTypes = 'video';
8
+
9
+ export interface SearchieVideoInfo extends VideoInfo<SearchieUrlParameters, SearchieMediaTypes> {
10
+ provider: 'searchie';
11
+ channel: string;
12
+ }
13
+
14
+ export type VoomlyParseResult = SearchieVideoInfo | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ormoshe/js-video-url-parser",
3
- "version": "0.5.21",
3
+ "version": "0.5.22",
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",