Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
1cb7888
Test
Ns-AnoNymouS Jun 23, 2021
775f2fe
Update index.js
Ns-AnoNymouS Jun 23, 2021
8d1b156
Update index.js
Ns-AnoNymouS Jun 23, 2021
7994332
Update index.js
Ns-AnoNymouS Jun 23, 2021
6239d5f
Update index.js
Ns-AnoNymouS Jun 23, 2021
89a9fae
Update index.js
Ns-AnoNymouS Jun 23, 2021
4d7850a
Update index.js
Ns-AnoNymouS Jun 23, 2021
617173f
Update index.js
Ns-AnoNymouS Jun 23, 2021
85c5b6e
Update index.js
Ns-AnoNymouS Jun 23, 2021
8b2e838
Update index.js
Ns-AnoNymouS Jun 23, 2021
7b1329b
Update index.js
Ns-AnoNymouS Jun 23, 2021
2e09753
Update index.js
Ns-AnoNymouS Jun 23, 2021
7b47e03
Update index.js
Ns-AnoNymouS Jun 23, 2021
426abec
Update index.js
Ns-AnoNymouS Jun 23, 2021
9cfb692
Update index.js
Ns-AnoNymouS Jun 23, 2021
7a9b681
Update README.md
Ns-AnoNymouS Jun 23, 2021
703f4b4
Update README.md
Ns-AnoNymouS Jun 23, 2021
c42ca64
Update index.js
Ns-AnoNymouS Jun 23, 2021
37dd9c5
Update index.js
Ns-AnoNymouS Jun 23, 2021
9c9c160
Update index.js
Ns-AnoNymouS Jun 23, 2021
2f7e2e4
Update index.js
Ns-AnoNymouS Jun 23, 2021
ca28275
Update index.js
Ns-AnoNymouS Jun 23, 2021
ac88185
Update index.js
Ns-AnoNymouS Jun 23, 2021
c3cd554
Update index.js
Ns-AnoNymouS Jun 23, 2021
d40832e
Update index.js
Ns-AnoNymouS Jun 23, 2021
cebfe05
Update index.js
Ns-AnoNymouS Jun 24, 2021
81cb5e4
Update index.js
Ns-AnoNymouS Jun 24, 2021
64435cd
Update index.js
Ns-AnoNymouS Jun 24, 2021
97e105d
Update index.js
Ns-AnoNymouS Jun 24, 2021
7541813
Update index.js
Ns-AnoNymouS Jun 24, 2021
4d8ed48
Update index.js
Ns-AnoNymouS Jun 24, 2021
5486e52
Update index.js
Ns-AnoNymouS Jun 24, 2021
669ee67
Update index.js
Ns-AnoNymouS Jun 24, 2021
290b2e9
Update index.js
Ns-AnoNymouS Jun 24, 2021
7355246
Update index.js
Ns-AnoNymouS Jun 24, 2021
0386f41
Update index.js
Ns-AnoNymouS Jun 24, 2021
c6a1522
Update index.js
Ns-AnoNymouS Jun 24, 2021
7524c79
Update index.js
Ns-AnoNymouS Jun 24, 2021
e0e84d4
Update index.js
Ns-AnoNymouS Jun 24, 2021
de312ac
Update index.js
Ns-AnoNymouS Jun 24, 2021
477a0bf
Update index.js
Ns-AnoNymouS Jun 24, 2021
50bcd8c
Update index.js
Ns-AnoNymouS Jun 24, 2021
3bc7b97
Added rename option
Ns-AnoNymouS Jun 24, 2021
07db731
Update README.md
Ns-AnoNymouS Jun 24, 2021
446a3c7
Update README.md
Ns-AnoNymouS Jun 24, 2021
28ccf4d
Update README.md
Ns-AnoNymouS Jun 24, 2021
9881ad4
Update README.md
Ns-AnoNymouS Jun 24, 2021
9b1bbaf
Update README.md
Ns-AnoNymouS Jun 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Seedr.cc API
![seedr.cc](https://user-images.githubusercontent.com/17960677/97034774-0b55bf00-1583-11eb-9529-807646a216de.png)



Unofficial API wrapper for seedr.cc
## Example
Expand Down Expand Up @@ -95,6 +95,57 @@ Prints Array of Arrays with file data
]
*/
```

### Getting contents in a specific folder
To get contents (all videos, files, etc in folder), use the `getFilesById` function

```js
var Seedr = require("seedr");
var seedr = new Seedr();
await seedr.login("email@example.com","password");

await seedr.getFilesById();

/*
Prints Array of Arrays with file data


{
parentId: 167483733,
name: 'Superman.and.Lois.S01E11.1080p.AMZN.WEBRip.DDP5.1.x264-NTb[rartv]',
folderSize: 129,
totalStorage: 2147483648,
usedStorage: 720392889,
type: 'folder',
files: [
{ id: 943600241,
type: 'file',
name: 'Newname',
size: 30
},
{
id: 943600242,
type: 'file',
name: 'RARBG_DO_NOT_MIRROR.exe',
size: 99
},
...
]
}

*/
```

### Renaming files
You can change the file name using this method
```js
var Seedr = require("seedr");
var seedr = new Seedr();
await seedr.login("email@example.com","password");

await seedr.rename("file_id", "newName");
```

### Deleting contents

To delete Folders use `deleteFolder` function and to delete files, use `deleteFiles` function
Expand Down
56 changes: 56 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,46 @@ module.exports = class Seedr {
return res;
}

async getFilesById(id = null) {
// getting the required url and requesting json data
if (id) {
var url = `https://www.seedr.cc/api/folder/${id}?access_token=${this.token}`
} else {
var url = `https://www.seedr.cc/api/folder?access_token=${this.token}`
}
var data = await axios(url);

// getting the parents if available else returning null
let parent
if (data.data.parent != -1) {
parent = data.data.parent
} else {
parent = null
}

var res = {parentId: parent, name: data.data.name, folderSize: 0, totalStorage: data.data.space_max, usedStorage: data.data.space_used, type: data.data.type, files: []};
for (var folder of data.data.folders) {
res.files.push({
id: folder.id,
type: 'folder',
name: folder.name,
size: folder.size
})
if (folder.size) {res.folderSize += parseInt(folder.size)}
}
for (var file of data.data.files) {
res.files.push({
id: file.folder_file_id,
type: 'file',
name: file.name,
size: file.size
})
if (file.size) {res.folderSize += parseInt(file.size)}
}

return res;
}

async getFile(id) {
var data = new FormData();
data.append('access_token', this.token);
Expand All @@ -90,6 +130,22 @@ module.exports = class Seedr {
return res.data;
}

async rename(id, newName) {
var data = new FormData();
data.append('access_token', this.token);
data.append('func', 'rename');
data.append('rename_to', newName)
data.append('file_id', id);

var res = await axios({
method: 'post',
url: 'https://www.seedr.cc/oauth_test/resource.php',
headers: data.getHeaders(),
data: data
});
return res.data;
}

async deleteFolder(id) {
var data = new FormData();
data.append('access_token', this.token);
Expand Down