torrent-online 1.4.4 → 1.4.8

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 (3) hide show
  1. package/README.md +17 -1
  2. package/package.json +1 -1
  3. package/wtui.js +39 -4
package/README.md CHANGED
@@ -13,6 +13,14 @@
13
13
 
14
14
  ## Быстрый старт
15
15
  ```bash
16
+ npx torrent-online
17
+ ```
18
+ Глобально один раз:
19
+ ```bash
20
+ npm i -g torrent-online && torrent-online
21
+ ```
22
+ Из исходников:
23
+ ```bash
16
24
  git clone https://github.com/IamCaptainPepe/torrent-online.git
17
25
  cd torrent-online
18
26
  npm i
@@ -92,7 +100,15 @@ docker run -p 8123:8123 torrent-online node wtui.js "magnet:?xt=..." --lan --no-
92
100
 
93
101
  # English
94
102
 
95
- ## Quick start
103
+ ## Quick Start
104
+ ```bash
105
+ npx torrent-online
106
+ ```
107
+ Install globally:
108
+ ```bash
109
+ npm i -g torrent-online && torrent-online
110
+ ```
111
+ From source:
96
112
  ```bash
97
113
  git clone https://github.com/IamCaptainPepe/torrent-online.git
98
114
  cd torrent-online
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "torrent-online",
3
- "version": "1.4.4",
3
+ "version": "1.4.8",
4
4
  "type": "module",
5
5
  "description": "Stream .torrent / magnet to VLC or browser — torrent streaming for macOS/Linux without a torrent client. Стрим торрентов в VLC или браузер.",
6
6
  "keywords": [
package/wtui.js CHANGED
@@ -259,10 +259,43 @@ function makeServer(torrent, base) {
259
259
  // ---- Поиск индексаторов ----
260
260
  const TRANSLIT = { а:'a',б:'b',в:'v',г:'g',д:'d',е:'e',ё:'e',ж:'zh',з:'z',и:'i',й:'y',к:'k',л:'l',м:'m',н:'n',о:'o',п:'p',р:'r',с:'s',т:'t',у:'u',ф:'f',х:'kh',ц:'ts',ч:'ch',ш:'sh',щ:'shch',ъ:'',ы:'y',ь:'',э:'e',ю:'yu',я:'ya' };
261
261
  function translit(s) { return s.toLowerCase().split('').map(c => TRANSLIT[c] ?? c).join(''); }
262
+
263
+ // RU->EN словарь популярных названий для TPB/1337x
264
+ const RU_EN = {
265
+ 'пацаны': 'the boys', 'во все тяжкие': 'breaking bad', 'лучше звонка сола': 'better call saul',
266
+ 'игра престолов': 'game of thrones', 'странные дела': 'stranger things', 'ведьмак': 'the witcher',
267
+ 'ходячие мертвецы': 'the walking dead', 'теория большого взрыва': 'the big bang theory',
268
+ 'клиника': 'scrubs', 'друзья': 'friends', 'голодные игры': 'the hunger games',
269
+ 'мистер робот': 'mr robot', 'шерлок': 'sherlock', 'южный парк': 'south park',
270
+ 'гриффины': 'family guy', 'симпсоны': 'the simpsons', 'футурама': 'futurama',
271
+ 'рик и морти': 'rick and morty', 'арчер': 'archer', 'американская история ужасов': 'american horror story',
272
+ 'сумерки': 'twilight', 'властелин колец': 'the lord of the rings', 'хоббит': 'the hobbit',
273
+ 'гарри поттер': 'harry potter', 'человек-паук': 'spider-man', 'бэтмен': 'batman',
274
+ 'супермен': 'superman', 'мстители': 'avengers', 'флэш': 'the flash', 'стрела': 'arrow',
275
+ 'тёмный рыцарь': 'the dark knight', 'диванный псих': 'divan', 'дэдпул': 'deadpool',
276
+ 'стражи галактики': 'guardians of the galaxy', 'человек-муравей': 'ant-man',
277
+ 'доктор стрэндж': 'doctor strange', 'веном': 'venom', 'джон уик': 'john wick',
278
+ 'терминатор': 'terminator', 'матрица': 'the matrix', 'чужой': 'alien',
279
+ 'хищник': 'predator', 'трансформеры': 'transformers', 'форсаж': 'fast and furious',
280
+ 'крид': 'creed', 'рокки': 'rocky', 'рамбо': 'rambo', 'неудержимые': 'the expendables',
281
+ 'миссия': 'mission impossible', 'индиана джонс': 'indiana jones', 'парк юрского периода': 'jurassic park',
282
+ 'аватар': 'avatar', 'титаник': 'titanic', 'оно': 'it', 'сияние': 'the shining',
283
+ 'мир дикого запада': 'westworld', 'наркос': 'narcos', 'элита': 'elite',
284
+ 'бумажный дом': 'la casa de papel', 'декстер': 'dexter', 'монк': 'monk',
285
+ 'последний богатырь': 'the last hero', 'чучело': 'scarecrow', 'фонари': 'lanterns',
286
+ 'гангстерленд': 'mobland', 'сердце пармы': 'heart of parma', 'метро 2033': 'metro',
287
+ };
288
+ function ruToEn(q) {
289
+ let s = q.toLowerCase().replace(/[«»\/]/g, ' ');
290
+ for (const k of Object.keys(RU_EN).sort((a, b) => b.length - a.length))
291
+ s = s.split(k).join(RU_EN[k]);
292
+ s = s.replace(/(\d+)\s*сезон/g, (m, n) => 's' + n.padStart(2, '0')).replace(/серия\b/g, 'episode');
293
+ return s.replace(/\s+/g, ' ').trim();
294
+ }
262
295
  function btihKey(mag) { const m = /btih:([0-9a-fA-F]{40}|[0-9a-fA-F]{32})/.exec(mag); return m ? m[1].toLowerCase() : mag.slice(0, 90); }
263
296
 
264
297
  async function search1337x(q) {
265
- const r = await fetch(`https://1337x.st/api/v1/search/${encodeURIComponent(q)}/1/1/`, {
298
+ const r = await fetch(`https://1337x.st/api/v1/search/${encodeURIComponent(q)}/1/1/1/0/`, {
266
299
  headers: { 'x-api-key': 'sk1337x73871873371873', 'user-agent': UA, accept: 'application/json' },
267
300
  signal: AbortSignal.timeout(9000),
268
301
  });
@@ -280,7 +313,7 @@ async function search1337x(q) {
280
313
  }
281
314
 
282
315
  async function searchTPB(q, host = 'https://tpb.party') {
283
- const r = await fetch(`${host}/s/?q=${encodeURIComponent(q)}&page=0&sort=0`, {
316
+ const r = await fetch(`${host}/search/${encodeURIComponent(q)}/0/99/200/`, {
284
317
  headers: { 'user-agent': UA },
285
318
  signal: AbortSignal.timeout(9000),
286
319
  });
@@ -307,19 +340,21 @@ async function searchRutor(q) {
307
340
  });
308
341
  if (!r.ok) throw new Error(`Rutor: HTTP ${r.status}`);
309
342
  const xml = await r.text();
343
+ const VIDEO = /фильм|сериал|мультип|аниме|телевизор|документ|спорт/i;
310
344
  const out = [];
311
345
  for (const item of xml.split('<item>').slice(1, 26)) {
312
346
  const title = decodeXml(/<title>([^<]*)<\/title>/.exec(item)?.[1] || '')
313
347
  .replace(/\s*\([^()]*\.torrent\)\s*$/, '');
348
+ const cat = decodeXml(/<description>([^<]*)<\/description>/.exec(item)?.[1] || '');
314
349
  const link = /<link>([^<]+)<\/link>/.exec(item)?.[1] || '';
315
- if (title && link.includes('download.php'))
350
+ if (title && link.includes('download.php') && VIDEO.test(cat))
316
351
  out.push({ name: title, mag: link, size: '', seeds: 0, src: 'Rutor' });
317
352
  }
318
353
  return out;
319
354
  }
320
355
 
321
356
  async function searchIndexers(q) {
322
- const queries = [...new Set([q.trim(), translit(q.trim())].filter(Boolean))];
357
+ const queries = [...new Set([q.trim(), translit(q.trim()), ruToEn(q.trim())].filter(Boolean))];
323
358
  const results = [];
324
359
  const notes = [];
325
360
  const jobs = [];