scttcper / qbittorrent Goto Github PK
View Code? Open in Web Editor NEWqBittorrent api wrapper
Home Page: https://qbittorrent.vercel.app
License: MIT License
qBittorrent api wrapper
Home Page: https://qbittorrent.vercel.app
License: MIT License
I'm getting this warning all the time:
warn - ../node_modules/@ctrl/qbittorrent/node_modules/keyv/src/index.js
Critical dependency: the request of a dependency is an expression
I was using another qBittorent package for my app that supports Commonjs. But this package doesn't support Commonjs and my typescript code is compiling to Commonjs and I can't change the typescript code to emit esm module JavaScript because the codebase is extremely large and I don't want to break other things.
Any walk around?
make the switch to ESM, might I suggest form-data-encoder
and
formdata-node
as a modern replacement for formdata
.
Further info: sindresorhus/got#1877
i set false/False on root_folder option and qbit create subfolder
The basic example doesn't work
My main.ts
import { QBittorrent } from '@ctrl/qbittorrent';
const client = new QBittorrent({
baseUrl: 'http://localhost:8080/',
username: 'admin',
password: 'adminadmin',
});
async function main() {
const res = await client.getAllData();
console.log(res);
}
main()
The error
$ ts-node ./src/main.ts
file:///C:/Users/<Name>/<programming folder>/node_modules/@ctrl/qbittorrent/dist/src/qbittorrent.js:12
import { urlJoin } from '@ctrl/url-join';
^^^^^^^
SyntaxError: The requested module '@ctrl/url-join' does not provide an export named 'urlJoin'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
at async loadESM (node:internal/process/esm_loader:85:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command
All API methods only allows GET or POST methods. Use POST when you are mutating some state (or when your request is too big to fit into GET) and use GET otherwise. Starting with qBittorrent v4.4.4, server will return 405 Method Not Allowed when you used the wrong request method.
removeTorrent, pauseTorrent, resumeTorrent.....
Hello,
I have the following error Uncaught (in promise) RequestError: The body option must be a stream.Readable, string or Buffer
on every request with your lib and I don't understand why ^^'
I'm testing with your example code :
const client = new QBittorrent({
baseUrl: 'http://localhost:8080/',
username: 'admin',
password: 'adminadmin',
});
async function main() {
const res = await qbittorrent.getAllData();
console.log(res);
}
Have nice day
When I see a torrent being downloaded on my qBittorrent instance, if I check the state from this lib API I get unknown
instead of downloading
.
If I pause, then it shows paused
correctly.
I am unable to use this library in some environments (even using all defaults) due to the aforementioned issue in GOT.
I'd like to primarily work with the normalized data but need some client-specific fields as well, one example is tags
.
With current design I'd have to fetch the same data twice which seem unneccecary.
It would be nice if either _normalizeTorrentData
was public so that I could use it myself after fetching with listTorrents
or that NormalizedTorrent
included a raw: Record<string, any>
property (or similar)
https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-list
Both the tag
and category
fields can accept an empty string, which the current implementation completely ignores:
qbittorrent/src/qbittorrent.ts
Lines 172 to 178 in 593035a
According to the docs the remove torrent function should be normalized between:
qbittorrent
deluge
transmission
utorrent
rtorrent
However, removeTorrent here returns a boolean
On Transmission it returns AddTorrentResponse
Deluge returns BooleanStatus
and uTorrent returns BaseResponse
Shouldn't this return a normalised result?
Would be nice to have this endpoint
https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-peers-data
In interface Preferences, there are some fields like add_trackers
and add_trackers_enabled
are missing.
You can refer to same types in repo Chicken/qbit.js.
I am using this library in conjunction with an RSS parser, as many RSS feeds, use magnets instead of links to torrent files, I require this functionality, after searching the codebase, the only reference I found is the "magnet_uri" property of the torrent interface, is there an easy way to implement this, I don't mind digging around and submitting a pr.
Not sure what happened. I can't use the lib anymore because of this error. I tried restarting Node, restarting qBittorrent, disabling e enabling remote, nothing seems to work.
I'm still investigating.
Is it possible to add a new torrent via torrent url, instead of local file path?
If so, I couldn't find it in the docs.
My app's throwing a not found error in development with the following statement (but build succeeds)
import { TorrentState } from "@ctrl/qbittorrent/dist/types";
May I suggest using the exports tag of package.json
in favor of the obsolete main
tag which should fix this.
Some reading:
https://dev.to/binjospookie/exports-in-package-json-1fl2
https://nodejs.org/api/packages.html
https://medium.com/swlh/npm-new-package-json-exports-field-1a7d1f489ccf
Whilst we're at it, why not switch the package to an ESModule? do you have any need to use commonjs, if not I'd be happy to commit the required changes.
Regards.
QBittorrent seems to have a default timeout of 3600 seconds (1 hour) for sessions when logging into the webui.
Based on the code, it does an initial login and for each request done with the same client instance, if there is a cookie set locally this._sid
it sets it as the Cookie header. However after the cookie expires, it doesn't re-login, it just keeps using the same expired cookie.
Potential solution for this is to make note of the expiration of the cookie itself and re-login when needed?
Is it possible to getting the hash of a magnet torrent after its just added?
As the number of methods supported by this repo grows (nearly 800 lines) it becomes increasingly unmaintainable, I suggest that index.ts
gets turned into a module loader and exporter of sorts and split all methods into there respective files under /src/methods
@scttcper what are your thoughts on this, mainly how you think such a module loader should be implmented?
Hi, I found that the 'tag' parameter of listTorrents function is missing.
See qBittorrent API documentation:https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#api-v283
Api method not implemented
https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#rename-folder
The qb auth api returns a session cookie
as described in this issue #86
I tested the client, _exp is a long time in the future such as 2038-01-19T03:14:07.000Z
so long-lived clients will still get a 403 error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.