Skip to content

feat: add Music category with TPB and 1337x sources#46

Closed
Manak-hash wants to merge 2 commits into
baairon:mainfrom
Manak-hash:feat/music-category
Closed

feat: add Music category with TPB and 1337x sources#46
Manak-hash wants to merge 2 commits into
baairon:mainfrom
Manak-hash:feat/music-category

Conversation

@Manak-hash

Copy link
Copy Markdown
Contributor

What and why

torlink covers Games, Movies, TV, and Anime but not Music. This PR adds Music as a fifth category, sourced from The Pirate Bay and 1337x — both zero-setup, no login required.

Sources

The Pirate Bay (tpb-music): Uses the existing apibay.org JSON API with audio category filtering (100-199: Music, FLAC, Audio Books, Sound Clips, Audio Other). Browse (empty query) hits the precompiled data_top100_100.json top-100 audio list. Magnets are built from info_hash via the shared buildMagnet helper — identical to how Movies/TV already work.

1337x (x1337-music): Reuses the existing HTML scraping in x1337.ts, targeting /category-search/{query}/Music/1/ for search and /popular-music for browse. The category slug was extended from "Movies" | "TV" to include "Music", with a clean ternary for the browse path.

What was NOT added

  • RuTracker: requires account login (breaks zero-setup)
  • SoulSeek: not a torrent protocol
  • Internet Archive: no seeder/leecher data (can't rank results by health)

Design choices

Each source mirrors its Movies/TV counterpart exactly — same search() function, same parsing, same error handling. No new state, no new keys, no new UI patterns. The sidebar picks up "Music" automatically from CATEGORIES.

Checklist

  • npm run typecheck is clean
  • npm test passes (97/97, including 4 new tests)
  • New logic has a test (vitest; mock fetch for API calls)
  • No new key bindings or Store fields
  • OS-touching code works on Windows, macOS, and Linux (pure HTTP, no platform branches)
  • One concern, with a Conventional Commits title (feat:)

Closes #40

macOS mDNSResponder permanently occupies UDP port 5350, which is the
NAT-PMP client port that webtorrent binds when initializing its NAT
traversal. The bind fails asynchronously with EADDRINUSE, and since
the PMP client is a raw EventEmitter with no error listener, it
surfaces as an uncaughtException that kills the app the moment a
download starts.

NAT-PMP can never succeed on macOS because the port is permanently
taken, so disable it on darwin only and let UPnP handle NAT traversal
instead. Other platforms are unaffected.

Closes baairon#22
Adds music torrent search alongside the existing Games, Movies, TV, and
Anime categories. Two sources, both zero-setup (no login):

- The Pirate Bay (apibay.org JSON API): audio categories 100-199,
  browse via precompiled top-100 audio list. Native JSON, magnet links
  built from info_hash with the shared tracker list.
- 1337x Music: reuses the existing HTML scraping infrastructure from
  the Movies/TV sources, targeting the /category-search/.../Music/
  URL pattern.

Each source mirrors its Movies/TV counterpart exactly:
- tpbMusic reuses piratebay.ts search() with MUSIC_CATS filter
- x1337Music reuses x1337.ts search() with the Music category slug

No new state, no new keys, no new UI surface beyond the sidebar entry.

Closes baairon#40
@baairon

baairon commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Thanks Manak, the implementation follows the grain nicely, but Music stays out of scope: it's a tiny slice of what people actually torrent, and torlink's promise is a short list of sources I can vouch for, which TPB and 1337x audio aren't.

@baairon baairon closed this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add Music category with torrent sources

2 participants