Skip to main content

An unofficial CLI tool and higher-level Python API client for 115.com cloud storage service

Project description

115cli

PyPI version test codecov

An unofficial CLI tool and Python library for 115.com cloud storage. It provides a command-line interface for common file operations and a higher-level Python API client that can be used as a library in your own code.

Read disclaimer carefully before using this tool.

中文版 README

Installation

pip install 115cli

Usage

CLI

After authenticating with 115cli login, you can use the 115cli command to interact with your 115 cloud storage. Here are some examples of available commands:

# Authenticate with cookies
115cli login cookie "UID=xxx; CID=xxx; SEID=xxx; KID=xxx"

# Account info
115cli account

# List files
115cli ls /
115cli ls /path/to/dir -l
115cli ls --id 1234567
# Sort by creation time, newest first
115cli ls -l --sort created --desc

# File operations
115cli mkdir /new-folder
115cli cp /src/file.txt /dst/
115cli mv /old/path /new/path
115cli rename /old/path/file.txt new-file.txt
115cli rm /path/to/file
115cli rm -r /path/to/dir
115cli find /search/path keyword

# File info and download
115cli stat /path/to/file
115cli id 1234567
115cli url /path/to/file
115cli url --format aria2c /path/to/file

# Download a file to local disk
115cli fetch /path/to/file.mp4
115cli fetch /path/to/file.mp4 -o /local/save/path.mp4
115cli fetch --id 1234567 -o /local/save/path.mp4
# Download a folder recursively, with integrity check
115cli fetch /path/to/dir/ -o /local/save/dir/ --check-integrity
# Download with include/exclude patterns
115cli fetch /path/to/dir/ -o /local/save/dir/ --include "**/*.mkv" --include "**/*.mp4" --exclude "secret/*"

# Upload (support instant upload)
115cli upload /local/file.txt /remote/dir/file.txt
# Upload with instant upload only
115cli upload --instant-only /local/file.txt /remote/dir/file.txt
# Upload a folder
115cli upload /local/folder/ /remote/dir/
# Upload with include/exclude patterns
115cli upload /local/folder/ /remote/dir/ --include "**/*.mkv" --include "**/*.mp4" --exclude "secret/*"

# Cloud download (offline download)
115cli download quota
115cli download list
115cli download list --filter completed
115cli download add "https://example.com/file.mp4"
115cli download delete <info_hash>
115cli download status <info_hash>
115cli download retry <info_hash>
115cli download clear --filter failed

# File share
115cli share info https://115.com/s/1234567 -p 6666
115cli share list https://115.com/s/1234567?password=6666
115cli share list https://115.com/s/1234567?password=6666 /dir/
115cli share stat https://115.com/s/1234567?password=6666 /path/to/file.txt
115cli share save https://115.com/s/1234567?password=6666 --dest /my/dir/
115cli share save https://115.com/s/1234567?password=6666 /path/in/share/ --dest /my/dir/ --include *.mp4 --include *.mkv --exclude *.txt

# Stream a video file
115cli stream /path/to/video.mp4

Note: Creating cloud download tasks may trigger a captcha challenge. This is currently not supported by the client.

Authentication

115cli currently only supports cookie-based authentication. Obtain your cookies from the browser after logging into 115.com. You need the UID, CID, SEID, and KID cookie values.

115cli login cookie "UID=xxx; CID=xxx; SEID=xxx; KID=xxx"

Python API

The package also exposes a higher-level Python API client that you can use in your own projects:

from cli115.auth import CookieAuth
from cli115.client import create_client

auth = CookieAuth(
    uid="xxx",
    cid="xxx",
    seid="xxx",
    kid="xxx"
)
client = create_client(auth)

# List directory
entries = client.file.list("/")
for entry in entries:
    print(entry.name, entry.id)

# Get file info
info = client.file.stat("/path/to/file.txt")
print(info.name, info.size, info.sha1)

# Download info
dl = client.file.url("/path/to/file.txt")
print(dl.url)

# Fetch a remote file as a lazy file-like object
with client.file.open("/path/to/file.txt") as rf:
    data = rf.read(1024)   # only downloads the first 1024 bytes

# Upload
result = client.file.upload("/remote/dir/", "/local/file.txt")

# Cloud download
client.download.add_url("https://example.com/file.mp4")
tasks = client.download.list()

This project is in an early stage of development, it may subject to breaking changes in the future.

Future Plans

The project aims to cover the core features of 115 cloud storage. Planned additions include:

  • QRCode login - Implementing QR code-based authentication for easier login without needing to manually extract cookies.

Credits

Some non-web API implementations are learned from p115client, which provides some non-web API implementations. Include but not limited to:

  • ECDH-AES encryption/decryption for file content and metadata.
  • Instant upload support by calculating file hashes and interacting with the corresponding APIs.
  • Multipart upload support for large files.

Disclaimer

This is an unofficial client for 115.com and is not affiliated with, endorsed by, or associated with 115.com or its parent company in any way.

Use at your own risk. The authors are not responsible for any account suspension, data loss, or other consequences arising from the use of this software. The API may change at any time without notice, which could break this tool.

You may encounter Aliyun WAF blocks when using the library, the mechanism and consequences are currently unknown. It may relate to the frequency of API calls. After being blocked, you may need to wait for a while before retrying, the official web interface may also be affected during the block period.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

115cli-0.3.2.tar.gz (65.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

115cli-0.3.2-py3-none-any.whl (72.4 kB view details)

Uploaded Python 3

File details

Details for the file 115cli-0.3.2.tar.gz.

File metadata

  • Download URL: 115cli-0.3.2.tar.gz
  • Upload date:
  • Size: 65.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for 115cli-0.3.2.tar.gz
Algorithm Hash digest
SHA256 0501ac0327fc4e0c9557f275ffe1273c55ff22dde0c92c73ca773fb09dbb01f9
MD5 bef5aca949f36ef8ad31777aea2942cf
BLAKE2b-256 cfb86fee17769f144a59b67f32c25951ea461f86827cfaa180b07631cc4bbed2

See more details on using hashes here.

File details

Details for the file 115cli-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: 115cli-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 72.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for 115cli-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c1c212b9193eac0db71fc4256d3628c7045155fc20d96732dae99139cf3b72d4
MD5 55c4653b6e4d7a24a5fcc1570a7affa5
BLAKE2b-256 6dcda796ad60338476ee7f630a162950246cdf897b1ba474bf3369440ee9c68a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page