GolinksPRO Download Manager
  1. หน้าหลัก
  2. วิธีใช้
  3. บรรทัดคำสั่งและการทำงานอัตโนมัติ

บรรทัดคำสั่งและการทำงานอัตโนมัติ

GDM can be driven without its window in three ways:

  • บรรทัดคำสั่งของแอป ใช้สวิตช์เดียวกับ IDM: ส่งการดาวน์โหลดไปยังแอปที่กำลังทำงานอยู่จากสคริปต์ ไฟล์แบตช์ หรือโปรแกรมอื่น
  • misterdownloadmanager-cli เครื่องมือบรรทัดคำสั่งแยกต่างหาก: ดาวน์โหลดไฟล์ วิดีโอ และทอร์เรนต์ในเทอร์มินัล พร้อมแสดงความคืบหน้า โดยไม่ต้องเปิดแอป
  • The automation API: other programs list the running app's downloads (as JSON) and pause, start, remove or delete them, over a local, token-protected channel. AI assistants use it through GDM's MCP server: see AI assistants.

To run the whole app without a window, on a home server or a NAS, see Run GDM on a server (misterdownloadmanager --headless); to control it from a phone, Control GDM from your phone.

ตัวอย่างใช้พาธของ Windows; บน macOS และ Linux โปรแกรมมีชื่อเดียวกันโดยไม่มี .exe

บรรทัดคำสั่งของแอป

misterdownloadmanager.exe /d URL [/p folder] [/f name] [/a] [/n] [/s]
ตัวเลือก การทำงาน
/d URL ที่อยู่สำหรับดาวน์โหลด
/p folder บันทึกในโฟลเดอร์นี้ (มิฉะนั้นจะใช้โฟลเดอร์ของหมวดหมู่จาก ตัวเลือก → บันทึกไปที่)
/f name บันทึกภายใต้ชื่อนี้
/a เพิ่มลงในคิวดาวน์โหลดหลักโดยไม่เริ่มดาวน์โหลด
/n เงียบ: ไม่มีหน้าต่าง ข้อมูลไฟล์ดาวน์โหลด การดาวน์โหลดจะเริ่มทันที (หรือเข้าคิวด้วย /a)
/s เริ่มคิวการดาวน์โหลดหลัก
/exit บันทึกและปิดแอปที่กำลังทำงานอยู่ (ตัวติดตั้งใช้ก่อนการอัปเกรด)
/startup Start in the notification area, the window hidden: what Launch GolinksPRO Download Manager on startup starts GDM with when you sign in. Where no notification area shows GDM's icon (some Linux desktops), GDM starts minimized. A running GDM stays as it is.
ไฟล์ .torrent หรือลิงก์ magnet: Open it in Add torrent (what Windows passes when GDM opens torrents).

Switches can start with / or -, in any case. If GDM is running, the command goes to it; if not, GDM starts and carries it out. For example:

misterdownloadmanager.exe /d https://example.com/files/report.pdf /p D:\Reports /n
misterdownloadmanager.exe /d https://example.com/big.iso /a
misterdownloadmanager.exe /s

misterdownloadmanager-cli

It comes with every download of GDM, next to the app (the installer puts it in GDM's folder). It works on its own: the app needn't run, except for status and api.

คำสั่ง การทำงาน
get URL [-o folder\|file] [-c connections] [-H "Header: value"]... [--checksum hash] [--dns choice] [--adapter name] ดาวน์โหลดไฟล์ด้วยการเชื่อมต่อสูงสุด 8 การเชื่อมต่อ (-c, 1 ถึง 128) พร้อมแสดงความคืบหน้า Ctrl+C หยุดชั่วคราว; resume ดำเนินการต่อ --checksum ตรวจสอบไฟล์ที่เสร็จสมบูรณ์: hex MD5, SHA-1, SHA-256, SHA-512 หรือ CRC32 โดยเลือกตั้งชื่อได้ (sha256:…) --dns เลือก DNS: system (ค่าเริ่มต้น); บริการและวิธีการสอบถาม, cloudflare-https, quad9-tls, google-plain, adguard-https, nextdns-tls; ที่อยู่ของเซิร์ฟเวอร์ DNS, 9.9.9.9,149.112.112.112; หรือที่อยู่ DNS-over-HTTPS จะไม่กลับไปใช้ DNS ของระบบ --adapter ส่งทุกการเชื่อมต่อผ่านอะแดปเตอร์เครือข่ายเดียว โดยใช้ชื่อ (Ethernet, wg0) หรือหนึ่งในที่อยู่ของมัน; หากไม่ได้เชื่อมต่อ จะไม่มีการส่งข้อมูลและการดาวน์โหลดจะล้มเหลว ลิงก์จากโฮสต์ไฟล์ที่บัญชี debrid ของคุณ (ตัวเลือก → บัญชี) รองรับ จะผ่านบัญชีนั้น เช่นเดียวกับในแอป และ get บอกว่า through Real-Debrid; --direct ดาวน์โหลดที่อยู่เอง (บัญชีบริการ Debrid)
resume file.mdm.json [-c connections] [-H ...] [--direct] ดำเนินการดาวน์โหลดที่หยุดชั่วคราวหรือเสียหายต่อจากไฟล์ .mdm.json ที่อยู่ข้างๆ ผ่านบัญชี debrid เช่นเดียวกับ get: บริการจะให้ลิงก์ใหม่เมื่อลิงก์เก่าหมดอายุ; --direct ดำเนินการต่อจากที่อยู่เอง
install-gallery-dl ติดตั้งหรืออัปเดต gallery-dl สำหรับแกลเลอรีรูปภาพ: รายการตรวจสอบผลรวมจะถูกตรวจสอบกับคีย์ลงนามของผู้เขียน และโปรแกรมจะถูกตรวจสอบกับรายการนั้น (Windows และ Linux x86-64; ที่อื่น ๆ ให้ติดตั้งเอง)
gallery-get URL [-o folder] [--limit N] [--adapter name] ดาวน์โหลดรูปภาพในแกลเลอรี (หมวดหมู่ Wikimedia Commons, อัลบั้ม Flickr, ...) ลงในโฟลเดอร์ที่ตั้งชื่อตามนั้นภายใน -o; --limit รับได้มากที่สุดเท่าที่ระบุ โดยเป็นรายการแรกที่เว็บไซต์แสดง หากเริ่มใหม่อีกครั้ง จะดึงเฉพาะรายการใหม่เท่านั้น --adapter ส่งการเชื่อมต่อของ gallery-dl ผ่านอะแดปเตอร์เครือข่ายเดียว เช่นเดียวกับ get
video-info URL วิดีโอที่หน้าเว็บมี (YouTube, Vimeo, ...), และคุณภาพที่เลือกได้
playlist-info URL [--from N] [--count N] วิดีโอของเพลย์ลิสต์หรือช่อง แต่ละรายการอยู่ในบรรทัดแยกกันตามที่แสดง: ตำแหน่ง, ความยาว, ชื่อเรื่อง และที่อยู่
playlist-get URL [-f selector] [-o folder] [--from N] [--count N] ดาวน์โหลดวิดีโอจากเพลย์ลิสต์หรือช่องทีละรายการลงในโฟลเดอร์ที่ตั้งชื่อตามเพลย์ลิสต์ภายใน -o -f คือคุณภาพเดียวสำหรับทั้งหมด เช่นเดียวกับ video-get (โดยค่าเริ่มต้นคือคุณภาพดีที่สุดของแต่ละวิดีโอ; bv*[height<=720]+ba/b[height<=720] = สูงสุด 720p; ba = เสียงต้นฉบับ; mp3:320, opus:, flac: เช่นเดียวกับ video-get)
video-get URL [-f selector] [-o folder] [--subs langs] [--auto-subs] [--embed-subs] [--adapter name] ดาวน์โหลดวิดีโอ; -f ใช้ตัวเลือกคุณภาพจาก video-info (b = ไฟล์เดียวที่ดีที่สุด; ba = เสียงอย่างเดียวตามที่เว็บไซต์มี ไม่มีการแปลง; mp3:320, mp3:256, mp3:192 หรือ mp3:128 = เสียงเป็น MP3 ที่บิตเรตนั้น, mp3:0 ที่บิตเรตแปรผันที่ดีที่สุด; opus: = เป็น Opus; flac: = เป็น FLAC, ไม่มีการสูญเสียแต่ไม่ดีไปกว่าเสียงของเว็บไซต์; การแปลงต้องใช้ ffmpeg) --subs บันทึกคำบรรยายไว้ข้างๆ: รหัสภาษาจาก video-info (en,fr) หรือ all สำหรับทุกภาษาที่ผู้อัปโหลดให้มา; --auto-subs ใช้คำบรรยายอัตโนมัติของเว็บไซต์แทน; --embed-subs ใส่ลงในวิดีโอ (ต้องใช้ ffmpeg, MP4 หรือ MKV) --adapter ส่งการเชื่อมต่อของ yt-dlp (และ ffmpeg) ผ่านอะแดปเตอร์เครือข่ายเดียว เช่นเดียวกับ get; เมื่อไม่ได้เชื่อมต่อ จะไม่มีอะไรเริ่มต้น
install-ytdlp, install-ffmpeg Install or update the helpers videos need: yt-dlp (checked against its signing key) and ffmpeg (Windows; on macOS and Linux GDM uses the system's).
torrent-info SOURCE ชื่อทอร์เรนต์, ไฟล์ (มีหมายเลข) และขนาด; SOURCE คือลิงก์แม่เหล็กหรือไฟล์ .torrent
torrent-get SOURCE [-o folder] [--files 0,2] [--use-existing] ดาวน์โหลดไฟล์ torrent หรือดาวน์โหลดเพียงบางไฟล์ หากมีบางไฟล์อยู่ในโฟลเดอร์อยู่แล้ว โปรแกรมจะหยุดและแสดงชื่อไฟล์เหล่านั้น --use-existing จะใช้ไฟล์เหล่านั้นแทน (ไฟล์ที่ตรงกันจะถูกเก็บไว้ ส่วนที่เหลือจะถูกดาวน์โหลด)
torrent-create PATH -o file.torrent สร้าง .torrent ของไฟล์หรือโฟลเดอร์ (ผู้เข้าร่วมค้นหาผ่าน DHT)
status การดาวน์โหลดของแอปที่กำลังทำงานอยู่ ในรูปแบบ JSON พร้อม ID (API สำหรับการทำงานอัตโนมัติต้องเปิดอยู่)
pause ID..., start ID... หยุดการดาวน์โหลดที่กำลังทำงานอยู่ หรือเริ่ม (ดำเนินการต่อ) การดาวน์โหลดที่หยุดชั่วคราว อยู่ในคิว หรือล้มเหลวในแอปที่กำลังทำงานอยู่
remove ID..., delete ID... นำการดาวน์โหลดออกจากรายการของแอปที่กำลังทำงานอยู่: remove เก็บไฟล์ไว้, delete ลบไฟล์ด้วย การดาวน์โหลดที่กำลังทำงานอยู่จะถูกหยุดชั่วคราวเป็นอันดับแรก (pause)
api on, api off เปิดหรือปิด API ระบบอัตโนมัติของแอปที่กำลังทำงานอยู่

misterdownloadmanager-cli help <command>แสดงทุกตัวเลือก คำสั่งที่ล้มเหลว (แอปไม่ได้ทำงาน, ตอบกลับด้วยข้อผิดพลาด, การดาวน์โหลดขัดข้อง) จะออกด้วยรหัส 1 ตัวอย่างเช่น:

misterdownloadmanager-cli get https://example.com/big.iso -o D:\Downloads -c 16 --checksum sha256:9f86d0…
misterdownloadmanager-cli video-get "https://www.youtube.com/watch?v=aqz-KE-bpKQ" -f "b[height=720]"
misterdownloadmanager-cli torrent-get "magnet:?xt=urn:btih:…" --files 0

JSON สำหรับสคริปต์และโปรแกรม

ด้วย --json (ก่อนหรือหลังคำสั่ง) ทุกคำสั่งจะพิมพ์ JSON แทนข้อความ, หนึ่งอ็อบเจกต์ต่อบรรทัด, สำหรับสคริปต์และ AI agent เพื่ออ่าน:

คำสั่ง พิมพ์
get, resume {"event": "through", "service"}อันดับแรกเมื่อการดาวน์โหลดผ่านบัญชี debrid จากนั้นเป็นบรรทัด {"event": "progress", "downloaded", "size", "speed", "connections", "segments"} ทุกครึ่งวินาที จากนั้น {"event": "done", "path", "size", "seconds"} หรือ {"event": "paused", "state"} หลังจาก Ctrl+C (state คือไฟล์ที่ resume ใช้)
video-get {"event": "progress", "downloaded", "size", "speed"}บรรทัด จากนั้น {"event": "done", "path", "subtitles", "subtitle_problems"}: ไฟล์คำบรรยายที่บันทึกไว้ข้างๆ และภาษาที่เว็บไซต์ปฏิเสธ ({"code", "name", "reason", "beside"}; beside: ได้มาในการลองครั้งที่สอง โดยอยู่ข้างวิดีโอแทนที่จะอยู่ในวิดีโอ)
torrent-get {"event": "progress", "phase", "downloaded", "size", "speed", "peers", "peers_seen"}บรรทัด, จากนั้น {"event": "done", "path", "size"}, หรือ {"event": "stopped", "downloaded", "seconds"} ด้วย --seconds
video-info {"title", "choices": [{"label", "format", "size"}], "subtitles": [{"code", "name", "automatic"}]}; format ของตัวเลือกคือสิ่งที่ video-get -f ใช้, code ของคำบรรยายคือสิ่งที่ --subs ใช้
torrent-info {"name", "info_hash", "size", "files": [{"index", "size", "path"}]}.
torrent-create {"info_hash", "path"}.
install-ytdlp, install-ffmpeg {"tool", "version", "path"}.
status, pause, start, remove, delete,api คำตอบของแอป ซึ่งเป็น JSON อยู่แล้ว (ดูด้านล่าง)

ขนาดเป็นไบต์ (null ขณะที่ไม่ทราบ), ความเร็วเป็นไบต์ต่อวินาที ความล้มเหลวจะพิมพ์ {"error": "…"} และออกด้วยรหัส 1 ตัวอย่างเช่น:

misterdownloadmanager-cli --json get https://example.com/big.iso -o D:\Downloads
{"event":"progress","downloaded":4194304,"size":1073741824,"speed":52428800,"connections":8,"segments":8}
…
{"event":"done","path":"D:\\Downloads\\big.iso","size":1073741824,"seconds":20.4}

API ระบบอัตโนมัติ

โปรแกรมอื่น ๆ สามารถสอบถามแอปที่กำลังทำงานอยู่ว่ากำลังดาวน์โหลดอะไรอยู่ และหยุดชั่วคราว, เริ่ม, ลบ หรือลบการดาวน์โหลดได้ API ปิดใช้งานโดยค่าเริ่มต้น; เปิดใช้งานด้วย misterdownloadmanager-cli api on (และปิดด้วย api off)

How a program talks to GDM

  1. While it runs, GDM listens on a port of 127.0.0.1 (this computer only) and writes the port and a secret token to ipc.json in its data folder: - Windows: %APPDATA%\misterdownloadmanager\ipc.json - macOS: ~/Library/Application Support/misterdownloadmanager/ipc.json - Linux: ~/.local/share/misterdownloadmanager/ipc.json - A portable copy: data\ipc.json next to the program.

The token changes at every start; only programs that can read your data folder (yours) can use it. 2. Connect to that port and send one line of JSON: the token and the command's fields, e.g. {"token": "<token>", "query": "list"}. 3. GDM answers with one line: ok for a command, or a JSON object for a question.

สิ่งที่เข้าใจ

ฟิลด์ (นอกจาก token) คำตอบ
{"query": "list"} ทุกการดาวน์โหลดและความเร็วรวม: {"downloads": [{"id", "file", "url", "path", "status", "size", "downloaded", "speed", "added", "category", "error"}], "speed": bytes per second, "queues": [{"name", "running", "ids"}], "categories": [{"key", "name"}], "free": bytes} status คือ Queued, Downloading, Stopped, Complete หรือ Error; size คือ null ในขณะที่ไม่ทราบ; error (สาเหตุที่ล้มเหลว) จะมีให้เฉพาะการดาวน์โหลดใน Error; category คือ key ของหมวดหมู่; free คือพื้นที่ว่างที่การดาวน์โหลดจะไป (null เมื่อไม่ทราบ) เฉพาะเมื่อ API เปิดอยู่เท่านั้น
{"action": "pause", "ids": [3, 4]} ดำเนินการกับการดาวน์โหลดตาม ID: "pause", "start", "remove" (เก็บไฟล์ไว้) หรือ "delete" (ลบไฟล์ด้วย) ตอบกลับ {"done": [3], "skipped": [{"id": 4, "why": "not running"}]}; การดาวน์โหลดที่กำลังทำงานอยู่จะต้องถูกหยุดชั่วคราวก่อนที่จะถูกลบหรือลบออก เฉพาะเมื่อ API เปิดอยู่
{"action": "start_queue", "queue": "Main download queue"} เริ่ม (หรือด้วย "stop_queue", หยุด) คิวที่มีชื่อนั้น (ชื่อจาก queues ของรายการ) ตอบกลับ {"done": [], "skipped": []} หรือ {"error": …, "code": "unknown-queue"} เฉพาะเมื่อ API เปิดอยู่เท่านั้น
{"api": true} / {"api": false} เปิดหรือปิด API: {"api": true}
{"url": "https://…", "dir": "D:\\Files", "name": "a.zip", "silent": true} เพิ่มการดาวน์โหลด เหมือนกับที่ /d /p /f /n ของบรรทัดคำสั่งทำ ("later": true คือ /a); ok "category" (คีย์จาก categories ของรายการ) จะใส่ไว้ในโฟลเดอร์ของหมวดหมู่นั้นแทนที่จะเป็นโฟลเดอร์ที่ประเภทของมันเลือก; "queue" (ชื่อคิว) คือคิวที่มันรออยู่ด้วย "later" นอกจากนี้ยังสามารถใช้ได้เมื่อปิด API เหมือนกับบรรทัดคำสั่ง
{"start_queue": true} เริ่มคิวการดาวน์โหลดหลัก; ok

คำถามหรือการกระทำที่ไม่รู้จักจะถูกตอบกลับ {"error": "…"} เช่นเดียวกับคำถามในขณะที่ API ปิดอยู่ (จากนั้นด้วย "code": "api-off" สำหรับโปรแกรมที่จะตรวจสอบ: ข้อความข้อผิดพลาดอาจเปลี่ยนแปลงได้) โทเค็นที่ไม่ถูกต้องจะถูกตอบกลับ denied

ทุกคำขอและคำตอบจะถูกอธิบายทีละฟิลด์ใน JSON Schema: automation-api.schema.json (และที่ https://misterdownloadmanager.com/automation-api.schema.json) ซึ่งสร้างขึ้นจากโค้ดที่แอปตอบกลับ ดังนั้นจึงยังคงถูกต้องแม่นยำ โปรแกรมสามารถตรวจสอบสิ่งที่ส่งและอ่านเทียบกับสิ่งนี้ หรือสร้างประเภทของตนเองจากสิ่งนี้ได้

ตัวอย่าง

PowerShell (Windows):

$ep = Get-Content "$env:APPDATA\misterdownloadmanager\ipc.json" | ConvertFrom-Json
$client = New-Object Net.Sockets.TcpClient("127.0.0.1", $ep.port)
$stream = $client.GetStream()
$writer = New-Object IO.StreamWriter($stream); $reader = New-Object IO.StreamReader($stream)
$writer.WriteLine((@{ token = $ep.token; query = "list" } | ConvertTo-Json -Compress))
$writer.Flush()
$reader.ReadLine() | ConvertFrom-Json | Select-Object -ExpandProperty downloads | Format-Table file, status, downloaded, size
$client.Close()

Python:

import json, os, socket

ipc = os.path.join(os.environ["APPDATA"], "misterdownloadmanager", "ipc.json")  # see above elsewhere
ep = json.load(open(ipc))
with socket.create_connection(("127.0.0.1", ep["port"])) as s:
    s.sendall((json.dumps({"token": ep["token"], "query": "list"}) + "\n").encode())
    answer = json.loads(s.makefile().readline())
for d in answer["downloads"]:
    print(d["file"], d["status"], d["downloaded"], d["size"])

หากต้องการเพิ่มการดาวน์โหลด ให้ส่ง {"token": "…", "url": "https://example.com/a.zip", "silent": true} แทน

ฟรี, โอเพนซอร์ส, ไม่มีโฆษณา, ไม่มีช่วงทดลองใช้

Download GolinksPRO Download Manager