DeepLX/README.md

159 lines
4.3 KiB
Markdown
Raw Normal View History

2022-10-20 02:11:14 +08:00
<!--
* @Author: Vincent Young
* @Date: 2022-10-18 07:32:29
* @LastEditors: Vincent Young
2023-04-23 13:49:25 +08:00
* @LastEditTime: 2023-04-23 13:49:08
2022-10-20 02:23:16 +08:00
* @FilePath: /DeepLX/README.md
2022-10-20 02:11:14 +08:00
* @Telegram: https://t.me/missuo
*
* Copyright © 2022 by Vincent, All Rights Reserved.
-->
2023-02-12 09:46:30 +08:00
# DeepL X
2022-10-20 02:13:42 +08:00
Permanently free DeepL API written in Golang
2022-10-20 02:11:14 +08:00
2022-10-20 02:23:16 +08:00
## Description
2023-04-23 13:25:47 +08:00
- `DeepLX` is listening to `0.0.0.0:1188` by default. You can modify the listening port by yourself.
- `DeepLX` is using `DeepL` Free API.
- `DeepLX` is unlimited to the number of requests.
2022-10-20 02:23:16 +08:00
2023-02-12 09:29:59 +08:00
## Usage
### Request Parameters
- text: string
- source_lang: string
- target_lang: string
### Response
```json
{
"alternatives": [
"Undisputed",
"Unquestionable",
"Unquestionably"
],
2023-02-12 09:29:59 +08:00
"code": 200,
"data": "Undoubtedly",
"id": 8300079001
2023-02-12 09:29:59 +08:00
}
```
2023-04-23 13:25:47 +08:00
### Specify the port
**Thanks to [cijiugechu](https://github.com/cijiugechu) for [his contribution](https://github.com/OwO-Network/DeepLX/commit/4a0920579ea868b0f05ccdff6bceae316bfd5dc8) to make this feature possible for this project!**
```bash
./deeplx -p 3333
# or
./deeplx -port 3333
```
2023-02-12 09:29:59 +08:00
2023-03-06 20:48:26 +08:00
### Run with Docker
```bash
2023-03-07 03:05:22 +08:00
# ghcr.io
2023-03-06 20:48:46 +08:00
docker run -itd -p 1188:1188 ghcr.io/owo-network/deeplx:latest
2023-03-07 03:05:22 +08:00
# dockerhub
docker run -itd -p 1188:1188 missuo/deeplx:latest
2023-03-06 20:48:26 +08:00
```
2023-03-07 03:12:31 +08:00
### Run with Docker Compose
```bash
mkdir deeplx
cd deeplx
wget https://raw.githubusercontent.com/OwO-Network/DeepLX/main/docker-compose.yaml
2023-03-17 17:27:19 +08:00
# docker compose v1
docker-compose up -d
# or docker compose v2
docker compose up -d
2023-03-07 03:12:31 +08:00
```
2023-02-18 21:01:05 +08:00
### Run on Linux Server
```bash
bash <(curl -Ls https://cpp.li/deeplx)
```
2023-02-12 09:29:59 +08:00
### Run on Mac
2023-03-02 23:22:26 +08:00
#### Homebrew (Recommended)
2023-04-23 13:49:25 +08:00
**For unknown reasons v0.7.8 does not work properly with Homebrew, so we are still using v0.7.7 for our version of Homebrew, it has no bugs and it is almost perfect.**
2023-03-02 11:51:56 +08:00
```bash
brew tap owo-network/brew
brew install deeplx
brew services start owo-network/brew/deeplx
2023-03-03 02:26:49 +08:00
2023-03-03 02:27:30 +08:00
# Update to the latest version
2023-03-03 02:26:49 +08:00
brew update
brew upgrade deeplx
brew services restart owo-network/brew/deeplx
# View the currently installed version
brew list --versions deeplx
2023-03-02 11:51:56 +08:00
```
#### Manual
2023-02-12 09:46:30 +08:00
1. Download the latest release of DeepL X.
2022-10-20 02:11:14 +08:00
```bash
sudo mv deeplx_darwin_amd64 /usr/local/bin/deeplx
2023-02-20 16:46:48 +08:00
sudo chmod +x /usr/local/bin/deeplx
2022-10-20 02:11:14 +08:00
```
2023-02-18 20:28:10 +08:00
2. Download the `me.missuo.deeplx.plist` to `~/Library/LaunchAgents`.
2022-10-20 02:11:14 +08:00
```bash
2023-02-18 19:46:43 +08:00
wget https://raw.githubusercontent.com/OwO-Network/DeepLX/main/me.missuo.deeplx.plist -O ~/Library/LaunchAgents/me.missuo.deeplx.plist
2022-10-20 02:11:14 +08:00
```
3. Run following command.
```bash
2023-02-18 19:46:43 +08:00
launchctl load ~/Library/LaunchAgents/me.missuo.deeplx.plist
launchctl start ~/Library/LaunchAgents/me.missuo.deeplx.plist
2022-10-20 02:11:14 +08:00
```
2023-02-16 20:38:33 +08:00
### Install from AUR
```bash
paru -S deeplx-bin
```
2023-02-24 21:37:01 +08:00
After installation, start the daemon with the following command.
2023-02-16 20:38:33 +08:00
```bash
systemctl daemon-reload
systemctl enable deeplx
2023-02-24 21:37:01 +08:00
2023-02-16 20:38:33 +08:00
```
2022-10-20 02:11:14 +08:00
## Setup on [Bob App](https://bobtranslate.com/)
2023-03-05 22:10:58 +08:00
1. Install [bob-plugin-deeplx](https://github.com/missuo/bob-plugin-deeplx) on Bob.
2022-10-20 02:11:14 +08:00
2023-03-07 04:10:38 +08:00
2. Setup the API. (If you use Brew to install locally you can skip this step)
2023-02-18 21:29:55 +08:00
![c5c19dd89df6fae1a256d](https://missuo.ru/file/c5c19dd89df6fae1a256d.png)
2022-10-20 02:11:14 +08:00
2023-02-28 18:15:54 +08:00
## Setup on [immersive-translate](https://github.com/immersive-translate/immersive-translate)
**It is not recommended, because the `immersive-translate` will send many requests in a short time, which will cause the `DeepL API` to block your IP.**
2023-02-28 18:15:54 +08:00
1. Install Latest [immersive-translate ](https://github.com/immersive-translate/immersive-translate/releases) on your browser.
2. Click on **Developer Settings** in the bottom left corner. **Enable Beta experimental features**.
2023-03-07 04:40:44 +08:00
3. Set the URL. (If you are not deploying locally, you need to change 127.0.0.1 to the IP of your server)
2023-03-04 16:57:28 +08:00
2023-03-07 04:40:44 +08:00
![6a48ba28621f2465028f0](https://missuo.ru/file/6a48ba28621f2465028f0.png)
2023-02-28 18:15:54 +08:00
2023-03-21 16:56:08 +08:00
## Use in Python
```python
import httpx, json
deeplx_api = "http://127.0.0.1:1188/translate"
data = {
"text": "Hello World",
"source_lang": "EN",
"target_lang": "ZH"
}
post_data = json.dumps(data)
r = httpx.post(url = deeplx_api, data = post_data).text
print(r)
```
2023-02-24 21:37:01 +08:00
## Backup the Docker Image of zu1k
2023-02-12 09:29:59 +08:00
```shell
2023-02-18 21:29:55 +08:00
docker run -itd -p 1188:80 missuo/deeplx-bk
2023-02-12 09:29:59 +08:00
```
2023-02-24 21:37:01 +08:00
**This docker image is not related to this project, as the original author deleted the image, it is only for backup.**
2023-02-12 09:29:59 +08:00
## Author
2023-02-25 22:27:15 +08:00
**DeepL X** © [DeepL X Contributors](https://github.com/OwO-Network/DeepLX/graphs/contributors), Released under the [MIT](./LICENSE) License.<br>