torrent-online 1.7.3 → 1.7.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/wtui.js +14 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "torrent-online",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
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
@@ -321,7 +321,7 @@ function btihKey(mag) { const m = /btih:([0-9a-fA-F]{40}|[0-9a-fA-F]{32})/.exec(
321
321
 
322
322
 
323
323
  async function searchTPB(q, host = '') {
324
- const hosts = ['https://tpb.party', 'https://piratebay.live'];
324
+ const hosts = ['https://tpb.party', 'https://piratebay.live', 'https://tpbay.site', 'https://piratebay6.org', 'https://thepiratebay3.org'];
325
325
  let html = '', lastErr = new Error('TPB: нет ответа');
326
326
  for (const h of (host ? [host] : hosts)) {
327
327
  try {
@@ -349,12 +349,19 @@ async function searchTPB(q, host = '') {
349
349
  }
350
350
 
351
351
  async function searchRutor(q) {
352
- const r = await fetch(`https://rutor.info/search/0/0/0/0/${encodeURIComponent(q)}/`, {
353
- headers: { 'user-agent': UA },
354
- signal: AbortSignal.timeout(9000),
355
- });
356
- if (!r.ok) throw new Error(`Rutor: HTTP ${r.status}`);
357
- const html = await r.text();
352
+ const hosts = ['https://rutor.info', 'https://rutor.is', 'https://newrutor.info'];
353
+ let html = '', lastErr = new Error('Rutor: нет ответа');
354
+ for (const h of hosts) {
355
+ try {
356
+ const r = await fetch(`${h}/search/0/0/0/0/${encodeURIComponent(q)}/`, {
357
+ headers: { 'user-agent': UA },
358
+ signal: AbortSignal.timeout(9000),
359
+ });
360
+ if (r.ok) { html = await r.text(); lastErr = null; break; }
361
+ lastErr = new Error(`Rutor: HTTP ${r.status}`);
362
+ } catch (e) { lastErr = e; }
363
+ }
364
+ if (lastErr) throw lastErr;
358
365
  const out = [];
359
366
  for (const row of html.split('<tr class="gai">').slice(1, 26)) {
360
367
  const magRaw = /href="(magnet:[^"]+)"/.exec(row)?.[1];