torrent-online 1.5.0 → 1.5.1

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/package.json +1 -1
  2. package/wtui.js +11 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "torrent-online",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
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
@@ -328,7 +328,7 @@ async function search1337x(q) {
328
328
  }
329
329
 
330
330
  async function searchTPB(q, host = 'https://tpb.party') {
331
- const r = await fetch(`${host}/search/${encodeURIComponent(q)}/0/99/200/`, {
331
+ const r = await fetch(`${host}/search/${encodeURIComponent(q)}/0/99/0/`, {
332
332
  headers: { 'user-agent': UA },
333
333
  signal: AbortSignal.timeout(9000),
334
334
  });
@@ -349,21 +349,21 @@ async function searchTPB(q, host = 'https://tpb.party') {
349
349
  }
350
350
 
351
351
  async function searchRutor(q) {
352
- const r = await fetch(`https://rutor.info/rss.php?search=${encodeURIComponent(q)}`, {
352
+ const r = await fetch(`https://rutor.info/search/0/0/0/0/${encodeURIComponent(q)}/`, {
353
353
  headers: { 'user-agent': UA },
354
354
  signal: AbortSignal.timeout(9000),
355
355
  });
356
356
  if (!r.ok) throw new Error(`Rutor: HTTP ${r.status}`);
357
- const xml = await r.text();
358
- const VIDEO = /фильм|сериал|мультип|аниме|телевизор|документ|спорт/i;
357
+ const html = await r.text();
359
358
  const out = [];
360
- for (const item of xml.split('<item>').slice(1, 26)) {
361
- const title = decodeXml(/<title>([^<]*)<\/title>/.exec(item)?.[1] || '')
362
- .replace(/\s*\([^()]*\.torrent\)\s*$/, '');
363
- const cat = decodeXml(/<description>([^<]*)<\/description>/.exec(item)?.[1] || '');
364
- const link = /<link>([^<]+)<\/link>/.exec(item)?.[1] || '';
365
- if (title && link.includes('download.php') && VIDEO.test(cat))
366
- out.push({ name: title, mag: link, size: '', seeds: 0, src: 'Rutor' });
359
+ for (const row of html.split('<tr class="gai">').slice(1, 26)) {
360
+ const magRaw = /href="(magnet:[^"]+)"/.exec(row)?.[1];
361
+ const name = decodeXml(/<a href="\/torrent\/\d+\/[^"]*">([^<]+)<\/a>/.exec(row)?.[1] || '');
362
+ if (!magRaw || !name) continue;
363
+ const size = decodeXml(/<td align="right">([\d.,]+)&nbsp;(GB|MB|KB|TB)/.exec(row)?.[0].replace('<td align="right">', '') || '')
364
+ .replace(/&nbsp;/g, ' ').trim();
365
+ const seeds = Number(decodeXml(/<td align="center">\s*<img[^>]*u\.png[^>]*>\s*([\d.,]+)/.exec(row)?.[1] || '0').replace(/[^\d]/g, '')) || 0;
366
+ out.push({ name, mag: decodeXml(magRaw), size, seeds, src: 'Rutor' });
367
367
  }
368
368
  return out;
369
369
  }