wyzie-lib 1.0.0

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 ADDED
@@ -0,0 +1,29 @@
1
+ # Wyzie Lib
2
+ Wyzie Lib is a package made for easily implementing [Wyzie Subs](https://subs.wyzie.ru) into your project without all the fuss.
3
+
4
+ ## Features
5
+ - **Simple**: Just one function for searching subtitles using Wyzie Subs API.
6
+ - **Fast**: This package was written in Vite with TypeScript, so it's fast and reliable.
7
+ - **Open-Source**: The API and package are open-source.
8
+
9
+ ## Installation
10
+ ### NPM
11
+ ```bash
12
+ npm install wyzie-lib
13
+ ```
14
+ ### PNPM
15
+ ```bash
16
+ pnpm install wyzie-lib
17
+ ```
18
+
19
+ ## Usage
20
+ ```ts
21
+ import { type SubtitleData, searchSubtitles } from 'wyzie-lib';
22
+
23
+ const data: SubtitleData[] = await Search({ tmdb_id: 286217, language: "en" });
24
+ console.log(data[0].id);
25
+ ```
26
+
27
+ <sup>
28
+ Created by <a href="https://github.com/itzcozi" alt="github" title="itzCozi on Github">BadDeveloper</a> with 💙
29
+ </sup>
@@ -0,0 +1,29 @@
1
+ async function h(t) {
2
+ const { tmdb_id: r, imdb_id: a, season: e, episode: c, language: i, format: u } = t, o = new URL("https://subs.wyzie.ru/search"), s = {
3
+ id: r || a,
4
+ season: e,
5
+ episode: c,
6
+ language: i,
7
+ format: u
8
+ };
9
+ return Object.keys(s).forEach((n) => {
10
+ s[n] !== void 0 && o.searchParams.append(n, String(s[n]));
11
+ }), o;
12
+ }
13
+ async function f(t) {
14
+ const r = await fetch(t.toString());
15
+ if (!r.ok)
16
+ throw new Error(`HTTP error! status: ${r.status}`);
17
+ return await r.json();
18
+ }
19
+ async function w(t) {
20
+ try {
21
+ const r = await h(t);
22
+ return await f(r);
23
+ } catch (r) {
24
+ throw console.error("Error fetching subtitles:", r), r;
25
+ }
26
+ }
27
+ export {
28
+ w as Search
29
+ };
@@ -0,0 +1 @@
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(n){const{tmdb_id:t,imdb_id:u,season:f,episode:d,language:h,format:l}=n,i=new URL("https://subs.wyzie.ru/search"),o={id:t||u,season:f,episode:d,language:h,format:l};return Object.keys(o).forEach(s=>{o[s]!==void 0&&i.searchParams.append(s,String(o[s]))}),i}async function a(n){const t=await fetch(n.toString());if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}async function c(n){try{const t=await r(n);return await a(t)}catch(t){throw console.error("Error fetching subtitles:",t),t}}e.Search=c,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "wyzie-lib",
3
+ "version": "1.0.0",
4
+ "main": "dist/wyzie-lib.umd.js",
5
+ "module": "dist/wyzie-lib.es.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "devDependencies": {
11
+ "@eslint/js": "^9.10.0",
12
+ "eslint": "^9.10.0",
13
+ "eslint-config-prettier": "^9.1.0",
14
+ "eslint-plugin-prettier": "^5.2.1",
15
+ "globals": "^15.9.0",
16
+ "prettier": "^3.3.3",
17
+ "typescript": "^5.5.3",
18
+ "typescript-eslint": "^8.5.0",
19
+ "vite": "^5.4.1"
20
+ },
21
+ "scripts": {
22
+ "dev": "vite",
23
+ "build": "vite build",
24
+ "lint": "eslint src",
25
+ "lint:fix": "eslint --fix src",
26
+ "format": "prettier --log-level warn --write \"src/**/*.{tsx,ts}\"",
27
+ "preview": "vite preview"
28
+ }
29
+ }