Total Pageviews

Saturday, 9 December 2023

LightUploader

 A lightweight, universal cloud drive upload tool for all platforms.

简体中文

MoeClub wrote a very good version, but unfortunately it's not open source and hasn't been updated in a while. This project is a simple upload tool separate from DownloadBot, designed to be a lightweight way to quickly upload data to various network drives on all platforms.

Features

  • Supports OneDrive Business, Personal (Home) versions, 21vianet (CN) version, Google Drive.
  • Support for uploading files and folders to specified directories, keeping the directory structure as it was before the upload.
  • Supports the use of command parameters for external applications.
  • Support for customising the upload chunk size.
  • Supports multi-threaded uploads (multiple files at the same time).
  • Support for dynamically adjusting the number of retries according to the file size.
  • Supports skipping the existing files with the same name in the OneDrive.
  • Support for real-time monitoring of upload progress via Telegram Bot, for easy monitoring of uploads when using fully automated download scripts.

Authorize

See wiki for details

Initialization profile

# OneDrive Business
LightUploader -a "url"

# OneDrive Business, and use Chinese language pack
LightUploader -a "url" -l zh-CN

# OneDrive Personal (Home)
LightUploader -a "url" -v 1

# OneDrive 21vianet (CN) version, and use Chinese language pack
LightUploader -a "url" -v 2 -l zh-CN

# Get the entire url in the browser address bar starting with http://loaclhost
# Replace the full url with the three letters of the "url" in the command
# Each url generated can only be used once, try again to retrieve the url
# This action will automatically initialise the configuration file

# Google Drive
LightUploader -v 3

Use

Usage of LightUploader:
  -a string
        //Setup and Init auth.json.
  -b string
        //Set block size. [Unit: M; 5<=b<=60;] (default "10")
  -c string
        //Config file.

  -r string
        //Upload to reomte path.
  -l string
        // Software language
  -f string
        // *Necessary parameters, file or folder to upload
  -t string
        // Number of threads, number of files uploaded at the same time. Default: 3
  -to int
        // The timeout time of a single packet is 60s by default
  -tgbot string
        //Use the Telegram bot to monitor uploads in real time, here you need to fill in the access token of the bot, e.g. 123456789:xxxxxxxxxx, use double quotes to wrap it
  -uid string
        // Use the Telegram bot to monitor uploads in real time, here you need to fill in the recipient's userID, shaped like 123456789
  -m int
        // Select the mode, 0 is to replace the file with the same name in cloud drive, 1 is to skip, the default is 0
  -v int
        // Select the version, where 0 is the OneDrive Business version and 1 is the OneDrive Personal (Home) version, 2 is OneDrive 21vianet (CN) version, 3 is Google Drive, the default is 0

Config

{
    "Drive":"OneDrive",
    // Authorisation tokens
    "RefreshToken": "1234564567890ABCDEF",
    // Maximum number of threads. (Number of simultaneous file uploads)
    "ThreadNum": 2,
    // Maximum upload chunk size. (The maximum chunk size for each file upload, it is recommended to reduce it if the network is not good. Unit: MB)
    "BlockSize": 10,
    // Maximum single file size. (Currently: 100GB single file limit for Personal Edition (Home Edition); 15GB single file limit for other editions, Microsoft will update to 100GB over time. Unit: GB)
    "SigleFile": 100,
    // If this is the Chinese version (CenturyLink), this should be true.
    "MainLand": false,
    //Software language
    "Language": "zh-CN",
    //timeout
    "TimeOut": 60,
    //Telegram Bot key
    "BotKey": "",
    //Telegram User ID
    "UserID": ""
}

Note that when a configuration file is used at the same time and the parameters in the configuration file are not the default values, the parameters in the configuration file will be used by default, and when parameters are entered on the command line, the parameters currently entered on the command line will be used and the parameters in the configuration file will be changed. That is, the parameters in the command line take precedence over the parameters in the configuration file and will change the parameters in the configuration file.

Examples

# Some examples:

# Upload the mm00.jpg file from the same directory to the root of the OneDrive
LightUploader -c xxx.json -f "mm00.jpg"

# Upload the Download folder from the same directory to the root of the OneDrive
LightUploader -c xxx.json -f "Download" 

# Upload the Download folder from the same directory to the Test directory of the OneDrive
LightUploader -c xxx.json -f "Download" -r "Test"

# Upload the Download folder from the same directory to the root of the OneDrive, using 10 threads
LightUploader -c xxx.json -t 10 -f "Download" 

# Upload the download folder in the same directory to the root directory of onedrive, use 10 threads, and skip the file with the same name
LightUploader -c xxx.json -t 10 -f "Download" -m 1

# Upload the download folder in the same directory to the root directory of onedrive, use 10 threads, and set the timeout to 30 seconds
LightUploader -c xxx.json -t 10 -f "Download" -to 30

# Upload the Download folder from the same directory to the root of the OneDrive, using 10 threads, while using Telegram Bot to monitor the progress of the upload in real time
LightUploader -c xxx.json -t 10 -f "Download" -tgbot "123456:xxxxxxxx" -uid 123456789

# Upload the download folder in the same directory to the root directory of onedrive network disk, use 10 threads, and use the telegram BOT parameter loader in the configuration file to monitor the upload progress in real time (provided that the configuration file contains the parameters of telegram BOT)
LightUploader -c xxx.json -t 10 -f "Download" -tgbot "1"


# Upload the Download folder from the same directory to the root of the OneDrive, using 15 threads, and setting the chunk size to 20M
LightUploader -c xxx.json -t 15 -b 20 -f "Download" 

Note

Returns 0 when there is no problem with the upload, which can be used as evidence of whether the upload has failed or not.

from https://github.com/gaowanliang/LightUploader

-------------------------------------------------------------

LightUploader,一个轻量化的网盘上传工具,支持OneDrive国际/个人/家庭版、Google Drive.

萌咖大佬写了一个 非常好的版本 ,可惜并没有开源,而且已经好久都没有更新了。这个项目作为从 DownloadBot 中独立出来的一个简易上传工具,旨在用更轻量化的方式让在各种平台都能快速的向各个网络硬盘上传数据。

这里只详细说下Linux的用法,Windows后面大概说下。

Windows、MacOS系统下载地址→传送门,直接将程序下载到本地后,按照下面方法进行授权、初始化,然后就可以使用命令上传了。

授权认证

点击右侧URL登录并授权,授权地址→【国际版、个人版(家庭版)】
【世纪互联】,Google Drive的授权链接是实时生成的,下面会说。

授权后会获取一个localhost开头打不开的链接,这里复制好整个链接地址,包括localhost。

安装LightUploader

打开这个界面,选择适合你系统的版本:https://github.com/gaowanliang/LightUploader/releases

这里以Linux 64位为例,当前最新版本为v2.0,应该下载 LightUploader_Linux_x86_64.tar.gz 这个文件.

# 下载文件
wget https://github.com/gaowanliang/LightUploader/releases/download/v2.0/LightUploader_Linux_x86_64.tar.gz
# 解压文件
tar -zxvf LightUploader_Linux_x86_64.tar.gz -C /usr/local/bin/

# 给予权限
chmod +x /usr/local/bin/LightUploader

# 可选 软链接 类似于 Windows 的快捷方式
ln -s /usr/local/bin/LightUploader /usr/bin/LightUploader

初始化配置

# OneDrive 国际版,将url换成你上面复制的授权地址,包括http://loaclhost。
LightUploader -a "url" -l zh-CN

# OneDrive 个人版(家庭版),将url换成你上面复制的授权地址,包括http://loaclhost。
LightUploader -a "url" -v 1 -l zh-CN

# OneDrive 中国版(世纪互联),将url换成你上面复制的授权地址,包括http://loaclhost。
LightUploader -a "url" -v 2 -l zh-CN

#Google Drive 是实时生成授权地址的,所以直接输入下面的命令然后按照指示操作即可。
LightUploader -v 3 -l zh-CN

如果提示注册成功类似信息,则初始化成功。

使用命令:

Usage of LightUploader:
-a string
// 初始化授权
Setup and Init auth.json.
-b string
// 自定义上传分块大小, 可以提高网络吞吐量, 受限于磁盘性能和网络速度.
-c string
// 配置文件路径

-r string
// 上传到网盘中的某个目录, 默认: 根目录
-l string
// 软件语言
-f string
// *必要参数, 要上传的文件或文件夹
-t string
// 线程数, 同时上传文件的个数. 默认: 3
-to int
//单个数据包超时时间,默认为60s
-tgbot string
//使用Telegram机器人实时监控上传,此处需填写机器人的access token,形如123456789:xxxxxxxxx,输入时需使用双引号包裹。当写入内容为“1”时,使用配置文件中的BotKey和UserID作为载入项
-uid string
// 使用Telegram机器人实时监控上传,此处需填写接收人的userID,形如123456789
-m int
// 选择模式,0为替换网盘中同名文件,1为跳过,默认为0
-v int
// 选择版本,其中0为 OneDrive 国际版,1为 OneDrive 个人版(家庭版),2为 OneDrive 世纪互联,3为Google Drive,默认为0.

命令示例:

# 一些示例:

# 将同目录下的 mm00.jpg 文件上传到 OneDrive 网盘根目录
LightUploader -c xxx.json -f "mm00.jpg"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录
LightUploader -c xxx.json -f "Download"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘Test目录中
LightUploader -c xxx.json -f "Download" -r "Test"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程
LightUploader -c xxx.json -t 10 -f "Download"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程,并跳过同名文件
LightUploader -c xxx.json -t 10 -f "Download" -m 1

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程,同时设置超时时间为30秒
LightUploader -c xxx.json -t 10 -f "Download" -to 30

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程,同时使用 Telegram Bot 实时监控上传进度
LightUploader -c xxx.json -t 10 -f "Download" -tgbot "123456:xxxxxxxx" -uid 123456789

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程,同时使用配置文件中的 Telegram Bot 参数载入程序实时监控上传进度(前提是配置文件中含有Telegram Bot 的参数)
LightUploader -c xxx.json -t 10 -f "Download" -tgbot "1"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 15 线程, 并设置分块大小为 20M
LightUploader -c xxx.json -t 15 -b 20 -f "Download"

/urs/local/auth.json为初始化时,生成的*.json绝对路径地址,本文默认/root/auth.json,自行调整。

Aria2自动上传

同样的这里也会提供个配套的Aria2自动上传脚本
上传脚本代码如下:

#!/bin/bash

GID="$1";
FileNum="$2";
File="$3";
MaxSize="157286400";
Thread="3"; #默认3线程,自行修改,服务器配置不好的话,不建议太多
Block="20"; #默认分块20m,自行修改
RemoteDIR=""; #上传到Onedrive的路径,默认为根目录,如果要上传到Test目录,""里面请填成Test
LocalDIR="/www/download/"; #Aria2下载目录,记得最后面加上/
Uploader="/usr/local/bin/LightUploader"; #上传的程序完整路径,默认为本文安装的目录
Config="/root/auth.json"; #初始化生成的配置auth.json绝对路径,参考第3步骤生成的路径


if [[ -z $(echo "$FileNum" |grep -o '[0-9]*' |head -n1) ]]; then FileNum='0'; fi
if [[ "$FileNum" -le '0' ]]; then exit 0; fi
if [[ "$#" != '3' ]]; then exit 0; fi

function LoadFile(){
if [[ ! -e "${Uploader}" ]]; then return; fi
IFS_BAK=$IFS
IFS=$'\n'
tmpFile="$(echo "${File/#$LocalDIR}" |cut -f1 -d'/')"
FileLoad="${LocalDIR}${tmpFile}"
if [[ ! -e "${FileLoad}" ]]; then return; fi
ItemSize=$(du -s "${FileLoad}" |cut -f1 |grep -o '[0-9]*' |head -n1)
if [[ -z "$ItemSize" ]]; then return; fi
if [[ "$ItemSize" -ge "$MaxSize" ]]; then
echo -ne "\033[33m${FileLoad} \033[0mtoo large to spik.\n";
return;
fi
${Uploader} -c "${Config}" -t "${Thread}" -b "${Block}" -f "${FileLoad}" -r "${RemoteDIR}"
if [[ $? == '0' ]]; then
rm -rf "${FileLoad}";
fi
IFS=$IFS_BAK
}
LoadFile;
编辑好上传脚本后,可以检测下脚本编码是否正确,比如我脚本路径为/root/upload.sh,使用命令:
bash /root/upload.sh 

如果无任何输出,则正确,反之输出类似$’r’: command not found错误,则需要转换下编码格式,具体步骤如下。

先安装dos2unix:

#CentOS系统
yum install dos2unix -y

#Debian/Ubuntu系统
apt install dos2unix -y
再转换编码:

#后面为脚本路径
dos2unix /root/upload.sh

Windows上的使用

这里就随便补充下Windows使用,先下载程序文件,下载地址→传送门

比如我将exe文件放到D盘,然后使用Win+R,输入CMD运行,调出窗口后,使用命令:

#进入D盘
cd /d D:\

#国际版初始化,将url换成你上面复制的授权地址,包括http://loaclhost。
LightUploader.exe -a "url" -l zh-CN

#个人版(家庭版)初始化,将url换成你上面复制的授权地址,包括http://loaclhost。
LightUploader.exe -a "url" -v 1 -l zh-CN

#世纪互联初始化,将url换成你上面复制的授权地址,包括http://loaclhost。
LightUploader.exe -a "url" -v 2 -l zh-CN

然后上传命令和上面一样,只需要把LightUploader改成LightUploader.exe即可。

更换自己的API

我本来想着做一个简单更换API的方法,但是思来想去不知道怎么弄好,因为本身这个软件是单文件的,首次就需要API进行登录,这个API存储在哪里就很麻烦了,索性就不弄了,和大家说一下如何通过自行编译的方式更换自己的API。

使用VSCode/Goland等工具,进行全局替换,需要查找的值有这几个:

  • OneDrive 国际版/家庭版 客户端ID:ad5e65fd-856d-4356-aefc-537a9700c137 (国际版不需要密钥)
  • OneDrive 世纪互联 客户端ID:4fbf37cf-dc83-4b60-b6c1-6230546e247b
  • OneDrive 世纪互联 密钥:y-L73QIBxO_UmJvOVw8YMlX~8B_h4D6zzT
  • Google Drive 授权文件:见gdUpload.go#L224

因为GoogleDrive还是测试版,目前传文件很不稳定,这里先简单的说一下OneDrive怎么弄

Azure.com 应用注册

Azure.cn (世纪互联) 应用注册

没有说明的随意填写即可

选择 任何组织目录(任何 Azure AD 目录 - 多租户)中的帐户

重定向 url 键入并保存 http://localhost/onedrive-login

保存 客户端ID

去 证书和密码 ,添加并保存 客户端密码(国际版不需要)

API 权限(Microsoft Graph)添加 offline_access, Files.ReadWrite.All, User.Read 三个权限。

下载好源代码后,使用上面说的工具,按下Ctrl+Shift+H,根据自己的情况将上面的值直接全局替换即可,因为我软件的依赖库都直接绑到代码里了,所以装好golang直接go build -o LightUploader .编译即可,不会出现依赖问题。

----------------------------------

 A distributed cross-platform Telegram Bot that can control your Aria2 server, control server files and also upload to OneDrive / Google Drive

简体中文 繁體中文

DownloadBot

Go Version Release Version GitHub license GitHub Star GitHub Fork

(Currently) 🤖 A distributed cross-platform Telegram Bot that can control your Aria2 server, control server files and also upload to OneDrive / Google Drive.

Project significance

The following is only a vision of what this program will look like when it is completed, the functions described so far are not fully implemented, please refer to the following Functions realized for details of implementation

This project is mainly to use small hard disk server for offline downloading, for large BitTorrent files to be downloaded in sections according to the size of the hard disk, each time downloading a part, then uploading the network disk, delete and then download the other parts, until all the files are downloaded.

At the same time, communication via the bot protocol facilitates use on machines that cannot intranet penetration, and simplifies the usual use of download programs for added convenience.For links, sending a message directly to the Bot will directly identify and download them. It can actually delete files from the download folder, which is not possible with web panels such as AriaNG, and is very convenient as a tool for managing downloads and notifying timely completion of downloads. You can move files, and for users who mount their hard drives via rclone you can copy and paste directly through this program, without having to open an ssh connection to the VPS for cp operations, which is also very convenient.

Functions realized:

Note: This project is still in beta testing and the Release submitted is for testing purposes only. Downloading it now does not guarantee you stable use, nor does it guarantee that the content ticked below has been implemented. The software is only stable when the submitted version is v1.0 (v1.0 will not implement all of the features below, but it will work properly and stably).

Only the checked content is currently implemented.

Download method

  • Aria2 control
    • Persistent monitoring
    • Automatic reconnection after disconnection
  • Multi download server control at the same time
    • Multi server download information notification using GRPC
  • SimpleTorrent control
  • qbittorrent control

The Bot protocol supports

  • Telegram Bot
    • Support multi-user use
    • Support group use
  • Tencent QQ (Use regular QQ users to interact)
  • DingTalk Bot

Function

  • Control server files
    • Delete files
    • Move/Copy files
    • Compressed files
  • Download files
    • Download HTTP/FTP link
    • Download Magnet link
    • Download the files in the BitTorrent file
    • Custom BitTorrent/Magnet download
      • Select only the largest file to download
      • Intelligent file selection based on file size, do not select small files in BitTorrent/Magnet.
    • Download files from OneDrive/SharePoint share links (Python script currently used as a demo)
      • xxx-my.sharepoint.com Download of share links
        • Downloading multiple files without password for shared links
        • Downloading multiple files with password for shared links
        • Download of files in nested folders
        • Download any file of your choice
      • xxx.sharepoint.com Downloads with share links
      • xxx-my.sharepoint.cn Download of share links (theoretically supported)
    • Download BitTorrent/Magnet according to the size of storage space
      • Do not download files that exceed storage space
      • Download the files in BitTorrent/Magnet several times according to the storage space
    • Senseless seeding functions
      • After each BitTorrent/Magnet file download, keep the last downloaded file for seeding until the next download starts.
      • Can be set to force seeding for a period of time at the end of each download
  • Upload a file
    • Upload the file to OneDrive when the download is complete
      • Resume from break point
      • Supports 21vianet (CN) version
    • Upload the file to Google Drive when the download is complete
      • Custom upload chunk size
      • Custom number of upload threads
      • Custom timeout time
    • Upload the file to Mega when the download is complete
    • Upload the file to 189Cloud when the download is complete
    • (When communicating via Telegram) Upload the file to Telegram when the download is complete
      • When the file exceeds 2GB, it is compressed in chunks before uploading
  • Additional features
    • Multilingual support
      • Simplified Chinese
      • English
      • Traditional Chinese
      • Japanese
    • No human intervention, fully automatic downloads of BitTorrent site
      • Nyaa
      • ThePirateBay
    • Other functions
      • File tree output system
        • File tree output for simple folders
        • Use multi message output for complex folder structures
      • Get all CIDs used in DMM via actor ID
      • Query the movie parameters in "ikoa" (using mahuateng).
      • Get the numbers of all actors via the javlibary actors' website.
      • Query the dmm cid information, preview the movie, preview the picture.
      • Search by keyword in sukebei.
      • Search in dmm based on keywords, up to 30 items.
      • Enter the dmm link to list all items.
      • Search for current dmm hits and the latest movies, limited to 30 (beta).

Current features

  1. Fully touch based, more easy to use, no command required to use this bot.
  2. Real time notification, it's now using Aria2's Websocket protocol to communicate.
  3. Better config file support.

Setup

  1. Create your own bot and get its access token by using @BotFather
  2. (Optional) Telegram blocked in your region/country? be sure to have a HTTP proxy up and running,and You can set your system environment variable HTTPS_Proxy is the proxy address.
  3. Download this program
  4. Configure config.json at the root of the program that you want to execute.
  5. Run the executable file

tutorial

For a more detailed tutorial, please see: Step by Step Guide for DownloadBot

DownloadBot Q&A

Screenshots


Example of a profile

{
  "input": {
    "aria2": {
      "aria2-server": "ws://127.0.0.1:6800/jsonrpc",
      "aria2-key": "123456"
    }
  },
  "output": {
    "telegram": {
      "bot-key": "",
      "user-id": ""
    }
  },
  "max-index": 10,
  "sign": "Main Aria2",
  "language": "en",
  "downloadFolder": "/root/download",
  "moveFolder": "/root/upload",
  "server": {
    "isServer": true,
    "isMasterServer": true,
    "serverHost": "127.0.0.1",
    "serverPort": 23369
  },
  "log": {
    "logPath": "",
    "errPath": "",
    "level": "info"
  }
}

Corresponding explanations

  • input : Input method, currently only supports aria2

    • aria2-server : Aria2 server address. Websocket connection is used by default. If you want to use websocket to connect to aria2, be sure to set enable-rpc=true in aria2.conf. If not necessary, please try to set the local aria2 address, in order to maximize the use of this program
    • aria2-key : The value of rpc-secret in aria2.conf
  • output : Output method, currently only supports telegram

    • bot-key : ID of telegram Bot, get it by using @BotFather
    • user-id : The ID of the administrator. It supports setting multiple users as administrators. Different users are separated by commas , . If you want to set the users whose user-id are 123465789, 987654321 and 963852741 as administrators, you need to set them as follows:
      {
        //···
        "user-id": "123456789",
        //···
      }
  • max-index:Maximum display quantity of download information, 10 pieces are recommended (to be improved in the future)

  • sign: Identification of this Bot, If multiple servers are required to connect to the same Bot, the specific server can be determined through this item.

  • language: Language of Bot output

  • downloadFolder: Aria2 download file save address.If you do not use this parameter, enter ""

  • moveFolder: The folder to which you want to move the files for the downloadFolder. If you do not use this parameter, enter ""

  • server: Server configuration

    • isServer: Whether to enable server mode, if you want to use this program as a server, set it to true(When set to false, it means that this machine is a client)
    • isMasterServer: Whether to enable master server mode, if you want to use this program as a master server, set it to true(now must be set to true)
    • serverHost: if it is a client, this item needs to fill in the server address, if it is the main server, this item is the local address
    • serverPort: If it is a client, this item needs to fill in the server port, if it is the main server, this item is the port provided to the client
  • log: Log configuration

    • logPath: Log file path, if you do not use this parameter, enter ""(now invalid)
    • errPath: Error log file path, if you do not use this parameter, enter ""(now invalid)
    • level: Log level, debug, info, warn, error, fatal, panic are supported, the default is info

Currently supported languages and language tags

Languages Tag
English en
Simplified Chinese zh-CN
Traditional Chinese zh-TW

When you fill in the above language tag in config.json, the program will automatically download the language pack

About user-id

If you don't know your user-id, you can leave this field blank and enter /myid after running the Bot, and the Bot will return your user-id.

from https://github.com/gaowanliang/DownloadBot

------------------------------------

相关帖子: https://briteming.blogspot.com/2021/07/gonelist.html 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

No comments:

Post a Comment