| name | borrow |
| description | Search and borrow media or documents using API. Use when users request to: (1) Search for media across multiple sources, (2) Download content via links, (3) Find media/documents to borrow |
Torrent Search & Download
Prerequisites
Search
scripts/search.sh <source> "<query>" [page]
scripts/search.sh piratebay "ubuntu iso" 1
scripts/search.sh yts "big buck bunny" 1
Sources
List available sources:
scripts/search.sh --list-sources
Get Magnet Link
scripts/search.sh piratebay "ubuntu" 1 | head -1 | cut -f4
scripts/search.sh piratebay "ubuntu" 1 | awk -F'\t' '$3+0 > 10 {print $4; exit}'
Download
node scripts/download.js "magnet:?xt=urn:btih:..." /tmp/downloads
node scripts/download.js "magnet:?xt=urn:btih:..." /tmp/downloads --timeout 3600
node scripts/download.js "magnet:?xt=urn:btih:..." /tmp/downloads --json
Complete Workflow
MAGNET=$(scripts/search.sh piratebay "ubuntu iso" 1 | head -1 | cut -f4)
node scripts/download.js "$MAGNET" /tmp/downloads
Troubleshooting
| Issue | Fix |
|---|
| API not responding | cd /tmp/Borrow && npm start & |
| Download slow/hangs | Filter for seeders > 20; try different source |