Python CLI tool to make uploads to your Terabox cloud from any Linux or Windows environment without having to use the website.
To use this tool you need to have a Terabox account and a JS Token key. You can get the session JS Token by logging into your Terabox account and following the sequence of steps below:
If you can't find the jsToken parameter, try selecting any other directory or file in the cloud and look for the jsToken parameter in the request payload. Make sure that you have the "XHR" filter selected and that you are looking at the "Payload" tab.
Additionally to the JS Token, you will need to capture the cookies values. You can get them by following the sequence of steps below:
You will need to copy the csrfToken, browserid, lang, ndus, and ndut_fmt values. This step is required to make the tool be compatible with the Terabox API as much as possible. Even though there are some paramters that are not directly used by the Terabox API, they can still create problems if they are not present in the request headers.
If you don't want to create the JSON files manually, you can use the argument setup
to create the secrets.json
and settings.json
files automatically. You can run the following command in the terminal to create the files:
python main.py setup
After running the command, the tool will ask you to input the values for your TeraBox credentials and the program settings values. You can then input the values and the tool will create the secrets.json
and settings.json
files automatically with the values you provided.
Create a file named secrets.json
in the same directory as the main.py
file. The file should have the following structure:
{
"jstoken": "your_js_token_here",
"cookies": {
"csrfToken": "your_csrf_token_here",
"browserid": "your_browser_id_here",
"lang": "en",
"ndus": "your_ndus_token_here",
"ndut_fmt": "your_ndut_fmt_token_here"
}
}
Replace the your_js_token_here
, your_csrf_token_here
, your_browser_id_here
, your_ndus_token_here
, and your_ndut_fmt_token_here
values with the ones you captured in the previous steps.
Create a file named settings.json
in the same directory as the main.py
file. The file should have the following structure:
{
"directories": {
"sourcedir": "source_directory_here",
"remotedir": "remote_terabox_directory_here",
"uploadeddir": "uploaded_files_directory_here"
},
"files": {
"movefiles": "false or true",
"deletesource": "false or true"
},
"encryption": {
"enabled": "true or false",
"encryptionkey": "your_encryption_key_here"
},
"ignoredfiles": [],
"appearance": {
"showquota": "true"
}
}
source_directory_here
value with the path to the directory you want to upload to Terabox. remote_terabox_directory_here
value with the path to the directory in your Terabox cloud where you want to upload the files. uploaded_files_directory_here
value with the path to the directory where you want to move the files after they are uploaded to Terabox. your_encryption_key_here
value with the key you want to use to encrypt the files before uploading them.enabled
value to false
. uploadeddir
after they are uploaded to Terabox, set the movefiles
value to true
. deletesource
value to true
. ignoredfiles
list.The tool uses some external libraries to work properly. You can install them by running the following command in the terminal:
pip install -r requirements.txt
In addition to the libraries listed in the requirements.txt
file, you will also need to have curl installed in your system to make the uploads to Terabox. The tool will attempt to bootstrap the curl installation if it is not present in your system, according to the OS you are using. However, if the tool is not able to install curl, you will need to install it manually.
For Windows, the tool will also attempt to install curl, but by utilizing a pre-built version of curl for Windows located here. You can also install curl manually by following the instructions in the curl website for downloading the binaries and utilizing the following method to install curl to be used by the tool:
Alternatively, you can also use the Windows Subsystem for Linux (WSL) to run the tool in a Linux environment.
The most important thing to use the tool is to have, of course, python installed in your system. If you don't have it installed, you can download it from the Python website.
To then run the tool, ensure that you have the secrets.json
and settings.json
files configured correctly and that you have installed the dependencies listed in the requirements.txt
file.
Then, simply run the main.py
file using the following command in the terminal:
python main.py
The tool will start the upload process and display the progress of the uploads in the console. Any errors that occur during the upload process will be displayed in the console. You can later check the terminal output to see if there were any errors during the upload process.
If you encounter any issues while using the tool, please open an issue in the Issues section of the repository. I will try to help you as soon as possible.
However, there are some common issues that you may encounter, which are listed below:
secrets.json
or settings.json
files.
main.py
file. secrets.json
file is not configured correctly or if the JS Token already expired.uploadeddir
directory after they are uploaded to Terabox.
settings.json
file is not configured correctly or if the uploadeddir
directory does not exist.settings.json
file is not configured correctly or if the encryption key specified is not valid to be used with this encryption algorithm.settings.json
file is not configured correctly or if the source files are being used by another process outside the tool.If you want to contribute to the project, please open a pull request in the Pull requests section of the repository. I will review your changes and merge them if they are appropriate.
This project is licensed under the MIT License - see the LICENSE file for details.