Torrent Scraper for Blogs and Forums

Description

Torrent Scraper for Blogs and Forums lets you publish torrent files and magnet links directly inside WordPress blog posts and wpForo forum topics, complete with live seeder, leecher, and download count badges that auto-update every 5 minutes via WP-Cron.

How It Works

  1. Upload a .torrent file or paste a magnet link through the admin dashboard or the wpForo topic editor.
  2. The plugin parses the torrent file using its built-in Bencode decoder — extracting the torrent name, total size, file count, and info hash. No external API is called for this step.
  3. The info hash is used to query the torrent’s tracker URLs (listed inside the .torrent file itself) using standard BitTorrent HTTP and UDP scrape protocols. The tracker responds with seeder/leecher/completed counts.
  4. Those counts are saved to the plugin’s own database tables and displayed on your posts or forum topics via shortcodes, Gutenberg blocks, or automatic injection.
  5. WP-Cron updates tracker stats every 5 minutes in the background.

Features

  • Torrent Parsing — Upload .torrent files or paste magnet links. Full Bencode decoding, single/multi-file support, info hash extraction. No third-party parser libraries required.
  • Live Tracker Stats — Seeder, leecher, and completed counts updated automatically every 5 minutes via WP-Cron. Supports both HTTP tracker scraping and UDP tracker scraping (BEP 15 protocol).
  • Gutenberg Blocks — 4 server-side rendered Gutenberg blocks: Torrent Info, Tracker Stats, Torrent Files, Magnet Button. No JavaScript build step required.
  • Shortcodes — 8 shortcodes for embedding torrent data anywhere in posts, pages, and forum topics.
  • REST API — Full JSON API at /wp-json/tsbf/v1/ with pagination, filtering, and per-IP rate limiting.
  • wpForo Forum Integration — Optionally attach torrent metadata cards to wpForo forum topics. Requires the wpForo plugin to be installed and active.
  • Admin Dashboard — Manage torrents, categories, settings, and run a system health check directly from the WordPress admin.
  • Security — Magic byte validation on file uploads, SSRF protection for tracker URLs, nonce verification on all forms, capability checks on all admin actions, parameterized database queries throughout.
  • Theme-Adaptive Design — Plugin UI inherits your active theme’s CSS variables for colors, fonts, and spacing. No manual CSS configuration needed.

wpForo Integration

When wpForo is active, the plugin adds a torrent attachment panel to the topic editor. Users with the appropriate capability can upload a .torrent file or paste a magnet link directly from the forum topic form. The torrent metadata card is then automatically displayed inside the topic. This integration is optional — the plugin works fully as a standalone blog plugin without wpForo installed.

Who Is This For?

  • Blog owners who want to embed torrent download information with live stats in their posts
  • Forum communities running wpForo who publish torrent-related content
  • Site administrators managing a torrent index or tracker listings

Requirements

  • PHP: 8.2 or higher
  • WordPress: 6.9 or higher
  • MySQL: 5.7+ or MariaDB 10.3+
  • PHP Extensions Required: sockets (UDP tracker scraping), curl (HTTP tracker scraping), mbstring (Bencode decoding), fileinfo (file upload security)
  • Optional: wpForo plugin (only required for forum integration)

After activating, visit Torrent Scraper — Settings — System Check to verify your server meets all requirements.

External Services

This plugin contacts external BitTorrent tracker servers to retrieve live seeder, leecher, and completed-download counts for torrents stored in your database. This section documents every external connection this plugin makes: what is sent, what is received, when it happens, how it happens, why it is needed, and which third-party service is involved.

Important: No personal user data is ever transmitted to any external server. No usernames, email addresses, passwords, WordPress session tokens, visitor IP addresses, or any personally identifiable information is sent to tracker servers under any circumstances.

Service 1: BitTorrent Tracker Servers (Core Feature — Tracker Scraping)

What this service is:
BitTorrent tracker servers are public network services that coordinate peer-to-peer file sharing. When a client queries a tracker using the “scrape” protocol, the tracker reports how many peers are currently seeding (uploading) a file, how many are leeching (downloading) it, and how many times it has been fully downloaded. This plugin uses that information to display live statistics on your WordPress site. The plugin does NOT seed or download any file content. It does NOT join any peer-to-peer swarm.

Which tracker servers are contacted:
The plugin contacts ONLY the tracker announce URLs that are embedded inside each .torrent file that a site administrator uploads through the admin dashboard or wpForo topic form. These tracker URLs are chosen by whoever originally created the torrent file — the plugin reads them from the file and uses them as-is. The plugin does NOT maintain its own hardcoded list of trackers.

Example of a tracker URL that may appear inside an uploaded torrent file:
udp://tracker.example.com/announce

When does this happen:
1. Immediately after upload — When a site administrator uploads a .torrent file or submits a magnet link, the plugin immediately sends one scrape request per tracker URL embedded in the torrent to populate the initial seeder/leecher statistics.
2. Every 5 minutes via WP-Cron — The plugin schedules a recurring background job (WordPress WP-Cron hook: tsbf_run_scheduler) that runs every 5 minutes and sends scrape requests for all active torrents in the database. This keeps statistics up to date automatically. This can be disabled via Settings — Integrations — Automatic Scraper.
3. Manual refresh — When a site administrator clicks the “Reload” button next to a torrent in the admin dashboard, the plugin immediately sends a fresh scrape request for that torrent.

How it works — HTTP Trackers (BitTorrent BEP 48 Scrape Convention):

What is sent (outbound):
An HTTP GET request is sent to the tracker’s scrape URL. The request contains:
– The torrent’s info hash: a 20-byte SHA-1 hash of the torrent file’s “info” dictionary, URL-percent-encoded. This is a mathematical identifier for the torrent and does not contain any personal data or file content.
– Standard HTTP request headers automatically included by WordPress’s built-in wp_remote_get() function, including a User-Agent string identifying the WordPress HTTP client.

Nothing else is sent. No user data. No file content. No authentication credentials.

What is received (inbound):
The tracker responds with a bencoded binary dictionary. The plugin decodes this response and extracts:
complete: An integer representing the current number of seeders (peers who have the complete file and are sharing it).
incomplete: An integer representing the current number of leechers (peers who are actively downloading the file).
downloaded: An integer representing the total number of times the complete file has been successfully downloaded from the swarm since the tracker began counting.

These three numbers are public, aggregate statistics. They do not identify any individual user. The plugin stores these three values in its own database table ({wordpress_prefix}tsbf_torrent_statistics) alongside a timestamp.

No other data from the HTTP response body is stored or used. HTTP response headers (such as cache-control or content-type) are used only to process the response and are not stored.

How it works — UDP Trackers (BitTorrent BEP 15 UDP Tracker Protocol):

What is sent (outbound):
UDP tracker communication follows a two-step handshake:

Step 1 — Connect Request (16 bytes):
connection_id: fixed protocol magic constant 0x41727101980 (publicly defined by the BitTorrent protocol specification)
action: integer 0 (meaning “connect”)
transaction_id: a randomly generated 32-bit integer used to match this request to its response; discarded after use; never stored

Step 2 — Scrape Request (sent after receiving a connection token):
connection_id: a temporary token issued by the tracker (valid for approximately 2 minutes; used only to send this request; never stored after the request completes)
action: integer 2 (meaning “scrape”)
transaction_id: a new randomly generated 32-bit integer; discarded after use
info_hash: the 20-byte raw binary SHA-1 info hash of the torrent

Side effect of network connection: Because UDP is connectionless, the tracker server will see your web server’s outbound IP address as the network source of the UDP packets. This is an unavoidable, standard side-effect of any internet connection and is equivalent to visiting any website. The plugin does not attempt to mask or spoof this.

Nothing else is sent. No user data. No file content.

What is received (inbound):
The tracker responds with a UDP scrape response packet. The plugin decodes this response and extracts:
seeders: Current number of peers with the complete file.
completed: Total number of successful complete downloads recorded by this tracker.
leechers: Current number of peers still downloading the file.

These three integers are stored in the plugin’s database ({wordpress_prefix}tsbf_torrent_statistics) alongside a timestamp. No other data from the UDP response is stored or used. The connection token and transaction ID are discarded immediately after the response is processed.

Why this is needed:
Without querying the tracker, the plugin has no way to display live seeder and leecher counts. These statistics are the core value of the plugin — they allow site visitors to see at a glance whether a torrent is well-seeded before downloading it. The scrape protocol is the only standardized, publicly available mechanism for retrieving this data from BitTorrent trackers.

Third-party tracker responsibility:
The plugin has no control over which trackers are embedded inside .torrent files uploaded by site administrators. Each tracker is a third-party service with its own policies. Site administrators are responsible for reviewing the tracker URLs embedded in the torrent files they upload. The plugin only sends the torrent’s info hash to each tracker — it does not send any personal data.

Summary Table

Connection
Destination
Trigger
Data Sent
Data Received
Stored

HTTP Tracker Scrape
Tracker URLs inside .torrent files
Upload, WP-Cron every 5 min, manual reload
Info hash (hex string)
Seeders, leechers, completed (3 integers)
Yes — in plugin database

UDP Tracker Scrape
Tracker URLs inside .torrent files
Upload, WP-Cron every 5 min, manual reload
Info hash (20 raw bytes)
Seeders, completed, leechers (3 integers)
Yes — in plugin database

Important Notes for Site Owners

  • No visitor data is ever sent to any external server. Tracker communication happens server-to-server (your web server to the tracker server). Your site visitors’ IP addresses, browsing history, identities, and any other personal information are never involved.
  • No file content is transmitted. Only a mathematical hash (the info hash) is sent to trackers. The actual torrent file, its contents, and any files being shared by the torrent are never sent to tracker servers.
  • Tracker scraping can be completely disabled. Turn off “Automatic Scraper (Cron)” in Settings — Integrations. Once disabled, the plugin will not contact any tracker server unless an administrator manually clicks the Reload button.
  • Site administrators control which trackers are queried. The plugin only contacts the tracker URLs embedded inside .torrent files that administrators choose to upload. Reviewing those tracker URLs before uploading is the site owner’s responsibility.

Shortcodes

  • [tsbf_torrent id="123"] — Torrent info card (name, size, file count, stats)
  • [tsbf_torrent_stats id="123"] — Seeder / leecher / completed badges only
  • [tsbf_torrent_files id="123"] — File count and total size table
  • [tsbf_magnet id="123"] — Magnet link button
  • [tsbf_torrent_list category="movies" limit="20" orderby="seeders"] — Sortable torrent table
  • [tsbf_global_stats] — Network-wide aggregate stats widget
  • [tsbf_user_torrents user_id="0" limit="20"] — Torrents uploaded by a user
  • [tsbf_torrent_browse] — Full browsable torrent listing page

Blocks

This plugin provides 4 blocks.

  • Torrent Info
  • Tracker Stats
  • Torrent Files
  • Magnet Button

Installation

  1. Upload the torrent-scraper-for-blogs-and-forums folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Visit Torrent Scraper — Settings — System Check to verify your hosting environment meets all requirements.
  4. Configure settings at Torrent Scraper — Settings.
  5. Use the Upload Torrent tab to add your first torrent, or embed one in a post using a shortcode or Gutenberg block.

FAQ

Does this plugin require any external API keys or paid services?

No. The plugin uses only the standard BitTorrent tracker scrape protocol, which is a free, open protocol. No API keys, accounts, or paid subscriptions are required.

Does this plugin work without wpForo?

Yes. The wpForo integration is fully optional. All core features (torrent upload, shortcodes, Gutenberg blocks, REST API, admin dashboard) work on any standard WordPress site without wpForo installed.

What happens if a tracker is offline or unreachable?

The plugin catches connection errors gracefully and skips the failed tracker. Previously stored counts are kept until the tracker becomes available again. No errors are shown to site visitors.

Does the plugin store torrent files on my server?

Yes. When a .torrent file is uploaded, it is saved to wp-content/uploads/torrent-scraper/. Magnet links do not create any files — only metadata is stored in the database.

What PHP extensions are required?

The sockets extension is required for UDP tracker scraping. The curl extension is required for HTTP tracker scraping. The mbstring extension is required for Bencode decoding of torrent metadata. The fileinfo extension is required for secure MIME type validation during file uploads. All can be verified via the built-in System Check page.

What data does the plugin store in the WordPress database?

The plugin creates its own tables (prefixed with {wordpress_prefix}tsbf_) to store: torrent metadata (name, size, info hash, file list), tracker URLs, scrape statistics (seeders, leechers, completed counts with timestamps), categories, log entries, and post/topic associations. No visitor personal data is stored in these tables.

Can I disable tracker scraping entirely?

Yes. Go to Torrent Scraper — Settings — Integrations and disable “Automatic Scraper (Cron)”. The plugin will stop its scheduled background scraping. Note that without periodic scraping, the seeder/leecher counts displayed on your site will become stale.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Torrent Scraper for Blogs and Forums” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.0

  • Initial release.
  • Torrent file upload and magnet link submission.
  • Live seeder/leecher/completed stats via HTTP and UDP tracker scraping (BEP 15).
  • WP-Cron scheduled background scraping (every 5 minutes).
  • 4 Gutenberg blocks: Torrent Info, Tracker Stats, Torrent Files, Magnet Button.
  • 8 shortcodes: [tsbf_torrent], [tsbf_torrent_stats], [tsbf_torrent_files], [tsbf_magnet], [tsbf_torrent_list], [tsbf_global_stats], [tsbf_user_torrents], [tsbf_torrent_browse].
  • REST API at /wp-json/tsbf/v1/ with pagination, filtering, and rate limiting.
  • wpForo forum integration (optional).
  • Admin dashboard with torrent management, categories, settings, and system health check.