wyzie-lib 2.0.8 → 2.0.9

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.
Files changed (2) hide show
  1. package/README.md +24 -25
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,6 +7,7 @@ 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.
10
11
  - **Simple**: Just one function for searching subtitles using Wyzie Subs API.
11
12
  - **Fast**: This package was written in Vite with TypeScript, so it's fast and reliable.
12
13
  - **Open-Source**: The API and package are open-source.
@@ -36,16 +37,14 @@ yarn add wyzie-lib
36
37
  ```ts
37
38
  import { type SubtitleData, searchSubtitles, parseToVTT } from "wyzie-lib";
38
39
 
39
- const params = { tmdb_id: 286217 };
40
-
41
40
  // Fetches all subtitles for the media with the TMDB ID 286217
42
41
  // -----------------------------------------------------------
43
- const data: SubtitleData[] = await searchSubtitles(params);
42
+ const data: SubtitleData[] = await searchSubtitles({ tmdb_id: 286217, format: "srt" });
44
43
  console.log(data[0].id); // Prints the ID of the first subtitle object
45
44
 
46
- // Converts the first subtitle to VTT format using the previous parameters provided
47
- // --------------------------------------------------------------------------------
48
- const vttContent = await parseToVTT(params, 0); // Use the first subtitle URL for convenience
45
+ // Converts the first subtitle from SRT to VTT format
46
+ // --------------------------------------------------
47
+ const vttContent = await parseToVTT(data[0].url); // Passes the first subtitle URL
49
48
  console.log(vttContent); // Prints the raw VTT content
50
49
  ```
51
50
 
@@ -70,35 +69,35 @@ console.log(vttContent); // Prints the raw VTT content
70
69
  ```ts
71
70
  interface SearchSubtitlesParams {
72
71
  // Parameters for the searchSubtitles() function
73
- tmdb_id?: number; // Parsed automatically by the API to recognize if its TMDB or IMDB
74
- imdb_id?: number; // Parsed automatically by the API to recognize if its TMDB or IMDB
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
75
74
  season?: number;
76
- episode?: number; // Season is required if episode is provided
77
- language?: string; // ISO 3166 code
78
- format?: string; // Subtitle file format
79
- hi?: boolean; // If the subtitle is hearing impaired
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
80
79
  }
81
80
 
82
81
  interface QueryParams {
83
82
  // Parameters for the wyzie-subs API
84
- id: string; // (Required) The TMDB or IMDB ID of the movie or TV show
85
- season?: number; // The season of the TV show (Required if episode is provided)
86
- episode?: number; // The episode of the TV show (Required if season is provided)
87
- language?: string; // ISO 3166 code
88
- format?: string; // Subtitle file format
89
- hi?: boolean; // If the subtitle is hearing impaired
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
90
89
  }
91
90
 
92
91
  type SubtitleData = {
93
92
  // Data returned by the API
94
- id: string; // Unique ID of the subtitle from opensubtitles
95
- url: string; // Direct download link of the subtitle
96
- format: string; // Subtitle file format
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
97
96
  isHearingImpaired: boolean; // If the subtitle is hearing impaired
98
- flagUrl: string; // Flag of the language
99
- media: string; // Media name of the subtitle
100
- display: string; // Actual name of the language
101
- language: string; // ISO 3166 code
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
102
101
  };
103
102
  ```
104
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyzie-lib",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "icon": "https://i.postimg.cc/L5ppKYC5/cclogo.png",
5
5
  "license": "MIT",
6
6
  "keywords": [