wyzie-lib 2.0.2 → 2.0.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
@@ -1,76 +1,96 @@
1
1
  # Wyzie Lib
2
2
 
3
- Wyzie Lib is a package made for easily implementing [Wyzie Subs](https://subs.wyzie.ru) into your project without all the fuss.
3
+ Wyzie Lib is a package made for easily implementing [Wyzie Subs](https://subs.wyzie.ru) into your
4
+ project without all the fuss.
4
5
 
5
6
  <sup>2.0 Out Now!</sup>
6
7
 
7
8
  ## Features
9
+
8
10
  - **Simple**: Just one function for searching subtitles using Wyzie Subs API.
9
11
  - **Fast**: This package was written in Vite with TypeScript, so it's fast and reliable.
10
12
  - **Open-Source**: The API and package are open-source.
11
-
13
+
12
14
  ## Installation
15
+
13
16
  ### NPM
17
+
14
18
  ```bash
15
19
  npm install wyzie-lib
16
20
  ```
21
+
17
22
  ### PNPM
23
+
18
24
  ```bash
19
25
  pnpm install wyzie-lib
20
26
  ```
27
+
21
28
  ### Yarn
29
+
22
30
  ```bash
23
31
  yarn add wyzie-lib
24
32
  ```
25
33
 
26
34
  ## Parameters
27
- - **tmdb_id**: The TMDB ID of the movie or TV show. *(tmdb_id or imdb_id is required)*
28
- - **imdb_id**: The IMDB ID of the movie or TV show. *(imdb_id or tmdb_id is required)*
29
- - **type**: The file format of the subtitles returned. *(srt, ass, vtt, txt, sub, mpl, webvtt, dfxp)*
30
- - **season**: Disired season of subtites *(this requires episode parameter aswell)*
35
+
36
+ - **tmdb_id**: The TMDB ID of the movie or TV show. _(tmdb_id or imdb_id is required)_
37
+ - **imdb_id**: The IMDB ID of the movie or TV show. _(imdb_id or tmdb_id is required)_
38
+ - **type**: The file format of the subtitles returned. _(srt, ass, vtt, txt, sub, mpl, webvtt,
39
+ dfxp)_
40
+ - **season**: Disired season of subtites _(this requires episode parameter aswell)_
31
41
  - **episode**: The episode of the given season.
32
42
  - **language**: The ISO 3166 code of the provided subtitles.
33
43
  - **display**: The actual name of the language capitalized.
34
44
  - **isHearingImpaired**: A boolean indicating if the subtitles are hearing impaired.
35
45
 
36
46
  ## Usage
47
+
37
48
  ```ts
38
49
  import { type SubtitleData, searchSubtitles } from "wyzie-lib";
39
50
 
40
51
  // IMDB is faster then TMDB due to less API calls behind the scenes
41
52
  const data: SubtitleData[] = await searchSubtitles({ tmdb_id: 286217 });
42
- console.log(data[0].id); // Prints the ID of the first subtitle provided in the search
53
+ console.log(data[0]); // Prints the object of the first subtitle provided in the search
43
54
  ```
55
+
44
56
  ### Types
57
+
45
58
  - **SubtitleData**: All returned values from the API with their respective types.
46
59
  - **SearchSubtitlesParams**: All valid parameters recognized by the API.
47
- - **QueryParams**: All parameters (optional and required) available for the wyzie-subs API.
60
+ - **QueryParams**: All parameters (optional and required) available for the wyzie-subs API.
61
+
48
62
  ```ts
49
- interface SearchSubtitlesParams { // Parameters for the searchSubtitles() function
50
- tmdb_id?: number; // Parsed automatically by the API to recognize if its TMDB or IMDB
51
- imdb_id?: number; // Parsed automatically by the API to recognize if its TMDB or IMDB
63
+ interface SearchSubtitlesParams {
64
+ // Parameters for the searchSubtitles() function
65
+ tmdb_id?: number; // Parsed automatically by the API to recognize if its TMDB or IMDB
66
+ imdb_id?: number; // Parsed automatically by the API to recognize if its TMDB or IMDB
52
67
  season?: number;
53
- episode?: number; // Season is required if episode is provided
54
- language?: string; // ISO 3166 code
55
- type?: string; // Subtitle file format
68
+ episode?: number; // Season is required if episode is provided
69
+ language?: string; // ISO 3166 code
70
+ format?: string; // Subtitle file format
71
+ hi?: boolean; // If the subtitle is hearing impaired
56
72
  }
57
73
 
58
- interface QueryParams { // Parameters for the wyzie-subs API
59
- id: string; // (Required) The TMDB or IMDB ID of the movie or TV show
60
- season?: number; // The season of the TV show (Required if episode is provided)
61
- episode?: number; // The episode of the TV show (Required if season is provided)
62
- language?: string; // ISO 3166 code
63
- type?: string; // Subtitle file format
74
+ interface QueryParams {
75
+ // Parameters for the wyzie-subs API
76
+ id: string; // (Required) The TMDB or IMDB ID of the movie or TV show
77
+ season?: number; // The season of the TV show (Required if episode is provided)
78
+ episode?: number; // The episode of the TV show (Required if season is provided)
79
+ language?: string; // ISO 3166 code
80
+ format?: string; // Subtitle file format
81
+ hi?: boolean; // If the subtitle is hearing impaired
64
82
  }
65
83
 
66
- type SubtitleData = { // Data returned by the API
67
- id: string; // Unique ID of the subtitle from opensubtitles
68
- url: string; // Direct download link of the subtitle
69
- type: string; // Subtitle file format
84
+ type SubtitleData = {
85
+ // Data returned by the API
86
+ id: string; // Unique ID of the subtitle from opensubtitles
87
+ url: string; // Direct download link of the subtitle
88
+ format: string; // Subtitle file format
70
89
  isHearingImpaired: boolean; // If the subtitle is hearing impaired
71
- flagUrl: string; // Flag of the language
72
- display: string; // Actual name of the language
73
- language: string; // ISO 3166 code
90
+ flagUrl: string; // Flag of the language
91
+ media: string; // Media name of the subtitle
92
+ display: string; // Actual name of the language
93
+ language: string; // ISO 3166 code
74
94
  };
75
95
  ```
76
96
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyzie-lib",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "icon": "https://i.postimg.cc/L5ppKYC5/cclogo.png",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -29,15 +29,15 @@
29
29
  }
30
30
  },
31
31
  "devDependencies": {
32
- "@eslint/js": "^9.12.0",
33
- "eslint": "^9.12.0",
32
+ "@eslint/js": "^9.14.0",
33
+ "eslint": "^9.14.0",
34
34
  "eslint-config-prettier": "^9.1.0",
35
35
  "eslint-plugin-import": "^2.31.0",
36
36
  "eslint-plugin-prettier": "^5.2.1",
37
- "globals": "^15.11.0",
37
+ "globals": "^15.12.0",
38
38
  "prettier": "^3.3.3",
39
39
  "typescript": "^5.6.3",
40
- "typescript-eslint": "^8.8.1",
40
+ "typescript-eslint": "^8.13.0",
41
41
  "vite": "^4.5.5"
42
42
  },
43
43
  "scripts": {
@@ -45,7 +45,7 @@
45
45
  "build": "vite build && tsc",
46
46
  "lint": "eslint src",
47
47
  "lint:fix": "eslint --fix src",
48
- "format": "prettier --log-level warn --write \"src/**/*.{tsx,ts}\"",
48
+ "format": "prettier --log-level warn --write \"{src/**/*.{ts,js,html,css},*.{ts,js,html,css,json,md,xml}}\"",
49
49
  "preview": "vite preview"
50
50
  }
51
51
  }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function h({tmdb_id:r,imdb_id:t,season:n,episode:c,language:o,type:a}){const e=new URL("https://subs.wyzie.ru/search"),i={id:String(r||t),season:n,episode:c,language:o,type:a};return Object.entries(i).forEach(([u,s])=>{s!==void 0&&e.searchParams.append(u,s)}),e}async function f(r){const t=await fetch(r.toString());if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}async function l(r){try{const t=await h(r);return await f(t)}catch(t){throw new Error(`Error fetching subtitles: ${t}`)}}exports.searchSubtitles=l;
@@ -1,36 +0,0 @@
1
- async function h({
2
- tmdb_id: t,
3
- imdb_id: r,
4
- season: e,
5
- episode: c,
6
- language: o,
7
- type: a
8
- }) {
9
- const s = new URL("https://subs.wyzie.ru/search"), i = {
10
- id: String(t || r),
11
- season: e,
12
- episode: c,
13
- language: o,
14
- type: a
15
- };
16
- return Object.entries(i).forEach(([u, n]) => {
17
- n !== void 0 && s.searchParams.append(u, n);
18
- }), s;
19
- }
20
- async function f(t) {
21
- const r = await fetch(t.toString());
22
- if (!r.ok)
23
- throw new Error(`HTTP error! status: ${r.status}`);
24
- return r.json();
25
- }
26
- async function w(t) {
27
- try {
28
- const r = await h(t);
29
- return await f(r);
30
- } catch (r) {
31
- throw new Error(`Error fetching subtitles: ${r}`);
32
- }
33
- }
34
- export {
35
- w as searchSubtitles
36
- };
@@ -1 +0,0 @@
1
- var WyzieLib=function(e){"use strict";async function c({tmdb_id:r,imdb_id:t,season:o,episode:u,language:h,type:f}){const n=new URL("https://subs.wyzie.ru/search"),b={id:String(r||t),season:o,episode:u,language:h,type:f};return Object.entries(b).forEach(([l,s])=>{s!==void 0&&n.searchParams.append(l,s)}),n}async function i(r){const t=await fetch(r.toString());if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}async function a(r){try{const t=await c(r);return await i(t)}catch(t){throw new Error(`Error fetching subtitles: ${t}`)}}return e.searchSubtitles=a,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
@@ -1 +0,0 @@
1
- (function(e,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(e=typeof globalThis<"u"?globalThis:e||self,r(e.WyzieLib={}))})(this,function(e){"use strict";async function r({tmdb_id:n,imdb_id:t,season:u,episode:a,language:f,type:h}){const s=new URL("https://subs.wyzie.ru/search"),d={id:String(n||t),season:u,episode:a,language:f,type:h};return Object.entries(d).forEach(([l,i])=>{i!==void 0&&s.searchParams.append(l,i)}),s}async function o(n){const t=await fetch(n.toString());if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}async function c(n){try{const t=await r(n);return await o(t)}catch(t){throw new Error(`Error fetching subtitles: ${t}`)}}e.searchSubtitles=c,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});