wyzie-lib 2.2.3 → 2.2.5
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.
- package/lib/main.amd.js +21 -2
- package/lib/main.cjs +21 -2
- package/lib/main.d.ts +18 -0
- package/lib/main.iife.js +21 -2
- package/lib/main.js +21 -2
- package/lib/main.umd.cjs +21 -2
- package/package.json +3 -3
package/lib/main.amd.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
define(["exports"], function(exports) {
|
|
2
2
|
"use strict";
|
|
3
|
+
const config = {
|
|
4
|
+
baseUrl: "https://sub.wyzie.ru"
|
|
5
|
+
};
|
|
6
|
+
function configure(options) {
|
|
7
|
+
if (options.baseUrl) {
|
|
8
|
+
config.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
9
|
+
}
|
|
10
|
+
}
|
|
3
11
|
async function constructUrl({
|
|
4
12
|
tmdb_id,
|
|
5
13
|
imdb_id,
|
|
@@ -9,9 +17,10 @@ define(["exports"], function(exports) {
|
|
|
9
17
|
language,
|
|
10
18
|
format,
|
|
11
19
|
source,
|
|
12
|
-
hi
|
|
20
|
+
hi,
|
|
21
|
+
...extraParams
|
|
13
22
|
}) {
|
|
14
|
-
const url = new URL(
|
|
23
|
+
const url = new URL(`${config.baseUrl}/search`);
|
|
15
24
|
const queryParams = {
|
|
16
25
|
id: String(tmdb_id || imdb_id),
|
|
17
26
|
season,
|
|
@@ -27,6 +36,15 @@ define(["exports"], function(exports) {
|
|
|
27
36
|
url.searchParams.append(key, String(value));
|
|
28
37
|
}
|
|
29
38
|
});
|
|
39
|
+
Object.entries(extraParams).forEach(([key, value]) => {
|
|
40
|
+
if (value !== void 0) {
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
url.searchParams.append(key, value.join(","));
|
|
43
|
+
} else {
|
|
44
|
+
url.searchParams.append(key, String(value));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
30
48
|
return url;
|
|
31
49
|
}
|
|
32
50
|
async function fetchSubtitles(url) {
|
|
@@ -84,6 +102,7 @@ ${textLines.join("\n")}
|
|
|
84
102
|
throw error;
|
|
85
103
|
}
|
|
86
104
|
}
|
|
105
|
+
exports.configure = configure;
|
|
87
106
|
exports.parseToVTT = parseToVTT;
|
|
88
107
|
exports.searchSubtitles = searchSubtitles;
|
|
89
108
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
package/lib/main.cjs
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const config = {
|
|
4
|
+
baseUrl: "https://sub.wyzie.ru"
|
|
5
|
+
};
|
|
6
|
+
function configure(options) {
|
|
7
|
+
if (options.baseUrl) {
|
|
8
|
+
config.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
9
|
+
}
|
|
10
|
+
}
|
|
3
11
|
async function constructUrl({
|
|
4
12
|
tmdb_id,
|
|
5
13
|
imdb_id,
|
|
@@ -9,9 +17,10 @@ async function constructUrl({
|
|
|
9
17
|
language,
|
|
10
18
|
format,
|
|
11
19
|
source,
|
|
12
|
-
hi
|
|
20
|
+
hi,
|
|
21
|
+
...extraParams
|
|
13
22
|
}) {
|
|
14
|
-
const url = new URL(
|
|
23
|
+
const url = new URL(`${config.baseUrl}/search`);
|
|
15
24
|
const queryParams = {
|
|
16
25
|
id: String(tmdb_id || imdb_id),
|
|
17
26
|
season,
|
|
@@ -27,6 +36,15 @@ async function constructUrl({
|
|
|
27
36
|
url.searchParams.append(key, String(value));
|
|
28
37
|
}
|
|
29
38
|
});
|
|
39
|
+
Object.entries(extraParams).forEach(([key, value]) => {
|
|
40
|
+
if (value !== void 0) {
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
url.searchParams.append(key, value.join(","));
|
|
43
|
+
} else {
|
|
44
|
+
url.searchParams.append(key, String(value));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
30
48
|
return url;
|
|
31
49
|
}
|
|
32
50
|
async function fetchSubtitles(url) {
|
|
@@ -84,5 +102,6 @@ ${textLines.join("\n")}
|
|
|
84
102
|
throw error;
|
|
85
103
|
}
|
|
86
104
|
}
|
|
105
|
+
exports.configure = configure;
|
|
87
106
|
exports.parseToVTT = parseToVTT;
|
|
88
107
|
exports.searchSubtitles = searchSubtitles;
|
package/lib/main.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type for the configuration options for the library.
|
|
3
|
+
*/
|
|
4
|
+
export declare type ConfigurationOptions = {
|
|
5
|
+
/** The API's hostname (default: sub.wyzie.ru) */
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Configure the library settings.
|
|
11
|
+
*
|
|
12
|
+
* @param {ConfigurationOptions} options - Config options for the library.
|
|
13
|
+
* @throws {Error} Throws an error if the baseUrl is not provided.
|
|
14
|
+
*/
|
|
15
|
+
export declare function configure(options: ConfigurationOptions): void;
|
|
16
|
+
|
|
1
17
|
/**
|
|
2
18
|
* Parses subtitle content from a URL to VTT format.
|
|
3
19
|
*
|
|
@@ -63,6 +79,8 @@ export declare type SearchSubtitlesParams = (
|
|
|
63
79
|
hi?: boolean;
|
|
64
80
|
/** The source where the subtitle where be scraped. */
|
|
65
81
|
source?: string;
|
|
82
|
+
/** Additional parameters that can be used for filtering or other purposes. */
|
|
83
|
+
[key: string]: any;
|
|
66
84
|
} & (
|
|
67
85
|
/** The number of the desired season you want subtitles for. */
|
|
68
86
|
{
|
package/lib/main.iife.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
var main = function(exports) {
|
|
2
2
|
"use strict";
|
|
3
|
+
const config = {
|
|
4
|
+
baseUrl: "https://sub.wyzie.ru"
|
|
5
|
+
};
|
|
6
|
+
function configure(options) {
|
|
7
|
+
if (options.baseUrl) {
|
|
8
|
+
config.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
9
|
+
}
|
|
10
|
+
}
|
|
3
11
|
async function constructUrl({
|
|
4
12
|
tmdb_id,
|
|
5
13
|
imdb_id,
|
|
@@ -9,9 +17,10 @@ var main = function(exports) {
|
|
|
9
17
|
language,
|
|
10
18
|
format,
|
|
11
19
|
source,
|
|
12
|
-
hi
|
|
20
|
+
hi,
|
|
21
|
+
...extraParams
|
|
13
22
|
}) {
|
|
14
|
-
const url = new URL(
|
|
23
|
+
const url = new URL(`${config.baseUrl}/search`);
|
|
15
24
|
const queryParams = {
|
|
16
25
|
id: String(tmdb_id || imdb_id),
|
|
17
26
|
season,
|
|
@@ -27,6 +36,15 @@ var main = function(exports) {
|
|
|
27
36
|
url.searchParams.append(key, String(value));
|
|
28
37
|
}
|
|
29
38
|
});
|
|
39
|
+
Object.entries(extraParams).forEach(([key, value]) => {
|
|
40
|
+
if (value !== void 0) {
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
url.searchParams.append(key, value.join(","));
|
|
43
|
+
} else {
|
|
44
|
+
url.searchParams.append(key, String(value));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
30
48
|
return url;
|
|
31
49
|
}
|
|
32
50
|
async function fetchSubtitles(url) {
|
|
@@ -84,6 +102,7 @@ ${textLines.join("\n")}
|
|
|
84
102
|
throw error;
|
|
85
103
|
}
|
|
86
104
|
}
|
|
105
|
+
exports.configure = configure;
|
|
87
106
|
exports.parseToVTT = parseToVTT;
|
|
88
107
|
exports.searchSubtitles = searchSubtitles;
|
|
89
108
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
package/lib/main.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
baseUrl: "https://sub.wyzie.ru"
|
|
3
|
+
};
|
|
4
|
+
function configure(options) {
|
|
5
|
+
if (options.baseUrl) {
|
|
6
|
+
config.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
1
9
|
async function constructUrl({
|
|
2
10
|
tmdb_id,
|
|
3
11
|
imdb_id,
|
|
@@ -7,9 +15,10 @@ async function constructUrl({
|
|
|
7
15
|
language,
|
|
8
16
|
format,
|
|
9
17
|
source,
|
|
10
|
-
hi
|
|
18
|
+
hi,
|
|
19
|
+
...extraParams
|
|
11
20
|
}) {
|
|
12
|
-
const url = new URL(
|
|
21
|
+
const url = new URL(`${config.baseUrl}/search`);
|
|
13
22
|
const queryParams = {
|
|
14
23
|
id: String(tmdb_id || imdb_id),
|
|
15
24
|
season,
|
|
@@ -25,6 +34,15 @@ async function constructUrl({
|
|
|
25
34
|
url.searchParams.append(key, String(value));
|
|
26
35
|
}
|
|
27
36
|
});
|
|
37
|
+
Object.entries(extraParams).forEach(([key, value]) => {
|
|
38
|
+
if (value !== void 0) {
|
|
39
|
+
if (Array.isArray(value)) {
|
|
40
|
+
url.searchParams.append(key, value.join(","));
|
|
41
|
+
} else {
|
|
42
|
+
url.searchParams.append(key, String(value));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
28
46
|
return url;
|
|
29
47
|
}
|
|
30
48
|
async function fetchSubtitles(url) {
|
|
@@ -83,6 +101,7 @@ ${textLines.join("\n")}
|
|
|
83
101
|
}
|
|
84
102
|
}
|
|
85
103
|
export {
|
|
104
|
+
configure,
|
|
86
105
|
parseToVTT,
|
|
87
106
|
searchSubtitles
|
|
88
107
|
};
|
package/lib/main.umd.cjs
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.main = {}));
|
|
3
3
|
})(this, function(exports2) {
|
|
4
4
|
"use strict";
|
|
5
|
+
const config = {
|
|
6
|
+
baseUrl: "https://sub.wyzie.ru"
|
|
7
|
+
};
|
|
8
|
+
function configure(options) {
|
|
9
|
+
if (options.baseUrl) {
|
|
10
|
+
config.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
5
13
|
async function constructUrl({
|
|
6
14
|
tmdb_id,
|
|
7
15
|
imdb_id,
|
|
@@ -11,9 +19,10 @@
|
|
|
11
19
|
language,
|
|
12
20
|
format,
|
|
13
21
|
source,
|
|
14
|
-
hi
|
|
22
|
+
hi,
|
|
23
|
+
...extraParams
|
|
15
24
|
}) {
|
|
16
|
-
const url = new URL(
|
|
25
|
+
const url = new URL(`${config.baseUrl}/search`);
|
|
17
26
|
const queryParams = {
|
|
18
27
|
id: String(tmdb_id || imdb_id),
|
|
19
28
|
season,
|
|
@@ -29,6 +38,15 @@
|
|
|
29
38
|
url.searchParams.append(key, String(value));
|
|
30
39
|
}
|
|
31
40
|
});
|
|
41
|
+
Object.entries(extraParams).forEach(([key, value]) => {
|
|
42
|
+
if (value !== void 0) {
|
|
43
|
+
if (Array.isArray(value)) {
|
|
44
|
+
url.searchParams.append(key, value.join(","));
|
|
45
|
+
} else {
|
|
46
|
+
url.searchParams.append(key, String(value));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
32
50
|
return url;
|
|
33
51
|
}
|
|
34
52
|
async function fetchSubtitles(url) {
|
|
@@ -86,6 +104,7 @@ ${textLines.join("\n")}
|
|
|
86
104
|
throw error;
|
|
87
105
|
}
|
|
88
106
|
}
|
|
107
|
+
exports2.configure = configure;
|
|
89
108
|
exports2.parseToVTT = parseToVTT;
|
|
90
109
|
exports2.searchSubtitles = searchSubtitles;
|
|
91
110
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wyzie-lib",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"icon": "https://i.postimg.cc/L5ppKYC5/cclogo.png",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"url": "git+https://github.com/itzcozi/wyzie-lib.git"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"prettier": "^3.
|
|
63
|
+
"prettier": "^3.6.0",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
65
65
|
"vite": "^4.5.14",
|
|
66
|
-
"vite-plugin-dts": "^4.5.
|
|
66
|
+
"vite-plugin-dts": "^4.5.4",
|
|
67
67
|
"vitest": "^2.1.9"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|