wyzie-lib 2.1.2 → 2.1.4

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/README.md CHANGED
@@ -7,9 +7,9 @@ project without all the fuss. [Read our source code!](https://github.com/itzcozi
7
7
 
8
8
  ## Features
9
9
 
10
- - **VTT Parser**: Convert SRT subtitles to VTT format quickly.
11
10
  - **Simple**: Just one function for searching subtitles using Wyzie Subs API.
12
11
  - **Fast**: This package was written in Vite with TypeScript, so it's fast and reliable.
12
+ - **VTT Parser**: Convert SRT subtitles to VTT format quickly.
13
13
  - **Open-Source**: The API and package are open-source.
14
14
 
15
15
  ## Installation
@@ -48,6 +48,8 @@ const vttContent = await parseToVTT(data[0].url); // Passes the first subtitle U
48
48
  console.log(vttContent); // Prints the raw VTT content
49
49
  ```
50
50
 
51
+ Check out demo.html for a working example using the VTT parser.
52
+
51
53
  ### Parameters
52
54
 
53
55
  | Parameter | Name | Description |
@@ -66,41 +68,6 @@ console.log(vttContent); // Prints the raw VTT content
66
68
  - **QueryParams**: All parameters (optional and required) available for the wyzie-subs API.
67
69
  - **SubtitleData**: All returned values from the API with their respective types.
68
70
 
69
- ```ts
70
- interface SearchSubtitlesParams {
71
- // Parameters for the searchSubtitles() function
72
- tmdb_id?: number; // Parsed automatically by the API to recognize if its TMDB or IMDB
73
- imdb_id?: number; // Parsed automatically by the API to recognize if its TMDB or IMDB
74
- season?: number;
75
- episode?: number; // Season is required if episode is provided
76
- language?: string; // ISO 3166 code
77
- format?: string; // Subtitle file format
78
- hi?: boolean; // If the subtitle is hearing impaired
79
- }
80
-
81
- interface QueryParams {
82
- // Parameters for the wyzie-subs API
83
- id: string; // (Required) The TMDB or IMDB ID of the movie or TV show
84
- season?: number; // The season of the TV show (Required if episode is provided)
85
- episode?: number; // The episode of the TV show (Required if season is provided)
86
- language?: string; // ISO 3166 code
87
- format?: string; // Subtitle file format
88
- hi?: boolean; // If the subtitle is hearing impaired
89
- }
90
-
91
- type SubtitleData = {
92
- // Data returned by the API
93
- id: string; // Unique ID of the subtitle from opensubtitles
94
- url: string; // Direct download link of the subtitle
95
- format: string; // Subtitle file format
96
- isHearingImpaired: boolean; // If the subtitle is hearing impaired
97
- flagUrl: string; // Flag of the language
98
- media: string; // Media name of the subtitle
99
- display: string; // Actual name of the language
100
- language: string; // ISO 3166 code
101
- };
102
- ```
103
-
104
71
  <hr />
105
72
 
106
73
  <sup>
package/lib/main.d.ts CHANGED
@@ -1,25 +1,33 @@
1
1
  export declare function parseToVTT(subtitleUrl: string): Promise<string>;
2
2
 
3
- export declare interface QueryParams {
3
+ export declare type QueryParams = {
4
4
  id: string;
5
5
  season?: number;
6
6
  episode?: number;
7
7
  language?: string;
8
8
  format?: string;
9
9
  hi?: boolean;
10
- }
10
+ };
11
11
 
12
12
  export declare function searchSubtitles(params: SearchSubtitlesParams): Promise<SubtitleData[]>;
13
13
 
14
- export declare interface SearchSubtitlesParams {
15
- tmdb_id?: number;
16
- imdb_id?: number;
17
- season?: number;
18
- episode?: number;
14
+ export declare type SearchSubtitlesParams = ({
15
+ tmdb_id: number;
16
+ imdb_id?: never;
17
+ } | {
18
+ imdb_id: string;
19
+ tmdb_id?: never;
20
+ }) & {
19
21
  language?: string;
20
22
  format?: string;
21
23
  hi?: boolean;
22
- }
24
+ } & ({
25
+ season: number;
26
+ episode: number;
27
+ } | {
28
+ season?: never;
29
+ episode?: never;
30
+ });
23
31
 
24
32
  export declare type SubtitleData = {
25
33
  id: string;
package/lib/main.js CHANGED
@@ -18,7 +18,7 @@ async function constructUrl({
18
18
  };
19
19
  Object.entries(queryParams).forEach(([key, value]) => {
20
20
  if (value !== void 0) {
21
- url.searchParams.append(key, value);
21
+ url.searchParams.append(key, String(value));
22
22
  }
23
23
  });
24
24
  return url;
package/lib/main.umd.cjs CHANGED
@@ -22,7 +22,7 @@
22
22
  };
23
23
  Object.entries(queryParams).forEach(([key, value]) => {
24
24
  if (value !== void 0) {
25
- url.searchParams.append(key, value);
25
+ url.searchParams.append(key, String(value));
26
26
  }
27
27
  });
28
28
  return url;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyzie-lib",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "icon": "https://i.postimg.cc/L5ppKYC5/cclogo.png",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -13,7 +13,8 @@
13
13
  "vite",
14
14
  "fast",
15
15
  "scraper",
16
- "subtitle scraper"
16
+ "subtitle scraper",
17
+ "open subtitles"
17
18
  ],
18
19
  "type": "module",
19
20
  "main": "./lib/main.js",
@@ -38,18 +39,17 @@
38
39
  "url": "git+https://github.com/itzcozi/wyzie-lib.git"
39
40
  },
40
41
  "devDependencies": {
41
- "globals": "^15.14.0",
42
42
  "prettier": "^3.4.2",
43
- "typescript": "^5.7.2",
43
+ "typescript": "^5.7.3",
44
44
  "vite": "^4.5.5",
45
- "vite-plugin-dts": "^4.4.0",
45
+ "vite-plugin-dts": "^4.5.0",
46
46
  "vitest": "^2.1.8"
47
47
  },
48
48
  "scripts": {
49
49
  "dev": "vite",
50
50
  "build": "vite build && tsc",
51
51
  "test": "npx vitest",
52
- "format": "prettier --log-level warn --write \"{src/**/*.{ts,js,html,css},*.{ts,js,html,css,json,md,xml}}\"",
52
+ "format": "prettier --log-level warn --write \"{src/**/*.{ts},*.{ts,js,html,css,json,md,xml}}\"",
53
53
  "preview": "vite preview"
54
54
  }
55
55
  }