Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
github.com/imerkle/go-qbittorrent
Golang wrapper for qBittorrent Web API (for versions above v3.1.x).
This wrapper is based on the methods described in qBittorrent's Official Web API Documentation <https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-Documentation>
__
This project is based on the Python wrapper by v1k45 <https://github.com/v1k45/python-qBittorrent>
__
Some methods are only supported in qBittorent's latest version (v3.3.1 when writing).
It'll be best if you upgrade your client to a latest version.
An example can be found in main.go
The best way is to install with go get::
$ go get github.com/superturkey650/go-qbittorrent/qbt
.. code-block:: go
import (
"superturkey650/go-qbittorrent/qbt
)
qb := qbt.NewClient("http://localhost:8080/")
qb.Login("admin", "your-secret-password")
// not required when 'Bypass from localhost' setting is active.
torrents = qb.Torrents()
for torrent := range torrents{
fmt.Println(torrent.name)
}
Get all active
torrents::
.. code-block:: go
qb.Torrents()
Filter torrents:: .. code-block:: go
filters := map[string]string{
"filter": "downloading",
"category": "my category",
}
qb.Torrents(filters)
// This will return all torrents which are currently
// downloading and are labeled as my category
.
filters := map[string]string{ "filter": paused, "sort": ratio, } qb.Torrents(filters) // This will return all paused torrents sorted by their Leech:Seed ratio.
Refer to qBittorents WEB API documentation for all possible filters.
Download torrents by link:: .. code-block:: go
options := map[string]string{} magnetLink = "magnet:?xt=urn:btih:e334ab9ddd91c10938a7....." qb.DownloadFromLink(magnetLink, options)
// Will return response object with 200:OK
status code
// regardless of sucess of failure.
Download multipe torrents by looping over links:: .. code-block:: go
options := map[string]string{} links := [...]string{link1, link2, link3} for l := range links{ qb.DownloadFromLink(l, options) }
Downloading torrents by file:: .. code-block:: go
options := map[string]string{} file = "path/to/file.torrent" qb.DownloadFromFile(file, options)
Downloading multiple torrents by using files:: .. code-block:: go
options := map[string]string{} file = [...]string{path/to/file1, path/to/file2, path/to/file3} qb.DownloadFromFile(file, options)
Specifing save path for downloads:: .. code-block:: go
savePath = "/home/user/Downloads/special-dir/" options := map[string]string{ "savepath": savePath } file = "path/to/file.torrent" qb.DownloadFromFile(file, options)
// same for links. savePath = "/home/user/Downloads/special-dir/" options := map[string]string{ "savepath": savePath } magnetLink = "magnet:?xt=urn:btih:e334ab9ddd91c10938a7....." qb.DownloadFromLink(magnetLink, options)
Applying labels to downloads:: .. code-block:: go
label = "secret-files ;)" options := map[string]string{ "label": label } file = "path/to/file.torrent" qb.DownloadFromFile(file, options)
// same for links. category = "anime" options := map[string]string{ "label": label } magnetLink = "magnet:?xt=urn:btih:e334ab9ddd91c10938a7....." qb.DownloadFromLink(magnetLink, options)
Pausing/ Resuming all torrents:: .. code-block:: go
qb.PauseAll() qb.ResumeAll()
Pausing/ Resuming a specific torrent:: .. code-block:: go
infoHash = "e334ab9ddd....infohash....5d7fff526cb4" qb.Pause(infoHash) qb.Resume(infoHash)
Pausing/ Resuming multiple torrents:: .. code-block:: go
infoHashes = [...]string{ "e334ab9ddd9......infohash......fff526cb4", "c9dc36f46d9......infohash......90ebebc46", "4c859243615......infohash......8b1f20108", }
qb.PauseMultiple(infoHashes) qb.ResumeMultiple(infoHashes)
All API methods of qBittorrent are mentioned in docs.txt
Jared Mosley (jaredlmosley) <https://www.github.com/superturkey650/>
__FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.