diff --git a/src/composers/TorrentsComposer.ts b/src/composers/TorrentsComposer.ts index 5759ad5..7cecc61 100644 --- a/src/composers/TorrentsComposer.ts +++ b/src/composers/TorrentsComposer.ts @@ -638,7 +638,10 @@ export class TorrentsComposer< const uid = `${se.name}_${result.id}`; const size = formatBytes(result.size ?? 0); const download = `/dl_${uid}`; - const tags = [`[${se.name}]`].join(' '); + const tags = [ + ...result.tags.map((tag) => `[${tag}]`), + `[${se.name}]`, + ].join(' '); return ctx.t('search-message', { title: result.title, diff --git a/src/searchEngines/RutrackerSearchEngine.ts b/src/searchEngines/RutrackerSearchEngine.ts index a92b54a..0358df7 100644 --- a/src/searchEngines/RutrackerSearchEngine.ts +++ b/src/searchEngines/RutrackerSearchEngine.ts @@ -106,18 +106,21 @@ export class RutrackerSearchEngine extends SearchEngine { continue; } - const title = tds.eq(3).find('a').text(); + const title = tds.eq(3).find('a').text().trim(); const size = Number.parseInt(tds.eq(5).attr('data-ts_text') ?? '0'); - const seeds = Number.parseInt(tds.eq(6).text()) ?? 0; - const peers = Number.parseInt(tds.eq(7).text()) ?? 0; + const seeds = Number.parseInt(tds.eq(6).text().trim()) ?? 0; + const peers = Number.parseInt(tds.eq(7).text().trim()) ?? 0; const publishDate = this.parseDate(tds.eq(9).attr('data-ts_text')); const detailsUrl = tds.eq(3).find('a').attr('href'); const downloadUrl = tds.eq(5).find('a').attr('href'); + const category = tds.eq(2).text().trim(); + const tags = [category]; if (title && downloadUrl) { results.push({ id, title, + tags, size, seeds, peers, diff --git a/src/searchEngines/SearchEngine.ts b/src/searchEngines/SearchEngine.ts index b946986..5790cc7 100644 --- a/src/searchEngines/SearchEngine.ts +++ b/src/searchEngines/SearchEngine.ts @@ -1,6 +1,7 @@ export interface SearchResult { id: string; title: string; + tags: string[]; size: number; seeds: number; peers: number;