希望有人可以幫助我。我正在嘗試了解qBittorrent Web API。目前,我列出了所有暫停的種子:
curl -i http://localhost:8080/api/v2/torrents/info?category=test
問題是列出了整個 JSON 陣列 - 我的問題是我可以只顯示“名稱”或“哈希”欄位嗎?這都是通過 cmd 使用 curl 的,但我已經在 Git Bash & Powershell 中嘗試過:
[{"eta":8640000,"f_l_piece_prio":false,"force_start":false,"hash":"8419d48d86a14335c83fdf4930843438a2f75a6b","last_activity":1664863523,"magnet_uri":"","max_seeding_time":0,"**name**":"TestTorrentName","num_complete":12,"num_incomplete":1,"num_leechs":0,"num_seeds":0,"priority":0,"progress":1,"ratio":0,"ratio_limit":-2,"save_path":"F:\\Completed\\test\\","seeding_time":0,"seeding_time_limit":-2,"seen_complete":1664863523,"seq_dl":false,"size":217388295,"state":"pausedUP","super_seeding":false,"tags":"","time_active":569,"total_size":217388295,"tracker":"udp://open.stealth.si:80/announce","trackers_count":10,"up_limit":-1,"uploaded":0,"uploaded_session":0,"upspeed":0}]
我已經嘗試了以下應該根據https://jqplay.org/作業的方法- 見截圖
curl -i http://localhost:8080/api/v2/torrents/info?category=test | jq --raw-output '.[] | .name'
但不幸的是,我收到以下錯誤:
curl -i http://localhost:8080/api/v2/torrents/info?category=test | jq --raw-output '.[] | .name'
% Total % Received % Xferd Average Speed Time '.name'' is not recognized as an internal or external command,
operable program or batch file.
Ti
uj5u.com熱心網友回復:
curl -i http://localhost:8080/api/v2/torrents/info?category=test | jq --raw-output '.[] | .name'
let curl 給出了-i一些頭部資訊,被決議為jq,但jq只能決議 JSON 端,因此失敗。
洗掉-i并可選地替換它-s以洗掉統計資訊:
curl -s http://localhost:8080/api/v2/torrents/info?category=test | jq --raw-output '.[] | .name'
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/511382.html
