Metadata-Version: 2.4
Name: weibo-image-rescue-tool
Version: 2.0.0
Summary: A command-line tool to rescue images from Weibo by updating and using CDN information.
Author-email: miles <runquant@gmail.com>
License-Expression: GPL-3.0-only
Project-URL: Homepage, https://github.com/rquanx/weibo-image-rescue
Project-URL: Repository, https://github.com/rquanx/weibo-image-rescue
Keywords: weibo,image,rescue,cdn,cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tqdm
Requires-Dist: requests
Requires-Dist: urllib3<2
Requires-Dist: httpx[http2]
Requires-Dist: brotli
Dynamic: license-file


# Weibo Image Rescue Tool

## Introduction

The Weibo Image Rescue Tool is a command-line utility designed to help you rescue images from Weibo by updating and using CDN information.

Inspired by [t0mbkeeper](https://weibo.com/6827625527/Ong3JyBf4) and [weibo-image-hound](https://github.com/zry98/weibo-image-hound/tree/main).

80% of the code was generated by ChatGPT-4.

## Features

- Update CDN information
- Force update CDN information and rescue image from a specific URL
- Rescue image from a specified URL

## Installation

Install from PyPI:

```bash
pip install weibo-image-rescue-tool
```

For local development:

```bash
git clone https://github.com/rquanx/weibo-image-rescue.git
cd weibo-image-rescue
pip install -e .
```

## Usage

### Update CDN Information

To update CDN information, use the `-u` flag:

```bash
weibo-image-rescue -u
```

### Force Update CDN Information and Rescue Image

To force update CDN information and rescue an image from a specific URL, use one of:

Preferred:

```bash
weibo-image-rescue --force-update <image_url>
```

Backward-compatible:

```bash
weibo-image-rescue -f <image_url>
```

### Rescue Image from a Specified URL

To rescue an image from a specified URL without updating the CDN information, simply provide the image URL:

```bash
weibo-image-rescue <image_url>
```

### Rescue Image with different quality

```bash
weibo-image-rescue <image_url> # default quality is all
weibo-image-rescue <image_url> -q ol,l,ml,m,o,t # form large to small
```

### Tune Concurrency and Timeout

```bash
weibo-image-rescue <image_url> --workers 30 --timeout 8
```

### Output Directory

```bash
weibo-image-rescue <image_url> --output-dir ./images
```

### Example

```bash
weibo-image-rescue -f https://example.com/image.jpg
```

## Arguments

- `-u, --update-cdn` : Update CDN information only.
- `--force-update` : Force update CDN information before rescuing positional `image_url`.
- `-f <image_url>` : Backward-compatible mode, force update and rescue specified URL.
- `-q` : Quality list, comma-separated values, e.g. `ol,l,ml,m,o,t`.
- `--workers` : Max concurrent probing requests.
- `--timeout` : Per-request timeout in seconds.
- `-o, --output-dir` : Directory for rescued image files.
- `image_url` : The URL of the image to rescue.

## License

This project is licensed under the terms of the GNU General Public License v3.0. See [LICENSE](LICENSE) for more details.

## Acknowledgements

Special thanks to all contributors and the open-source community for their invaluable support and contributions.
