Discuz Magnet Link Sender to qBittorrent

Send magnet links in Discuz posts to qB WebUI (Button + Right-Click dual mode)

Author
何双印
Daily installs
0
Total installs
9
Ratings
1 0 0
Version
0.8
Created
2025-09-17
Updated
2025-09-17
Size
5.41 KB
License
Apache-2.0
Applies to
All sites

Discuz Magnet Link Sender to qBittorrent Script (Button + Right-Click Dual Mode)

Version: 0.8 Platform: Tampermonkey / Violentmonkey Supported Browsers: Chrome / Firefox / Edge, etc.


Overview

This userscript targets magnet links (magnet:?) in Discuz forum posts and provides a dual-mode sending feature to qBittorrent WebUI:

1. Button Mode

  • Automatically scans <li> elements for magnet links in posts
  • Generates a rocket button ⤓ for each magnet link
  • Button placement: two levels above <li> in the DOM tree

    • Buttons will not be included when copying code
    • Keeps post formatting intact
  • Clicking the button sends the magnet link directly to the configured qB WebUI

2. Right-Click Selection Mode

  • You can select any magnet link text in the post
  • Use the Tampermonkey menu → 📡 Send selected magnet to qB
  • Sends the selected link to qB WebUI without needing a button

Features & Benefits

  • Auto Scan: Supports dynamically loaded post content
  • Universal ID: Works with Discuz code_XXXX code blocks, no manual ID modification needed
  • Safe Button Placement: Buttons are outside <li>, avoiding interference with "Copy Code"
  • Dual Mode: Button + right-click, flexible usage
  • Easy Configuration: Set qB WebUI address, username, and password via Tampermonkey menu
  • Status Feedback: Success shows ✓, failure shows ✕ with retry option

Usage

  1. Install Tampermonkey or Violentmonkey
  2. Install this userscript
  3. Configure qB WebUI address, username, and password via the script menu
  4. Open a Discuz post page; rocket buttons will automatically appear
  5. Click a button or select a magnet link and send it via right-click menu to qB WebUI

Notes

  • Compatible with qBittorrent WebUI v2 API
  • Ensure your browser can access the qB WebUI
  • The script scans all [id^="code_"] code blocks
  • Automatically rescans for dynamically loaded content or when navigating pages