scrape deepl via pyppeteer2 with para info
Project description
deepl-scraper-pp2
scrape deepl using pyppeteer2 with para info, cross platform (Windows/MacOS/Linux)
Intro
deepl-scraper-pp2
is more or less deepl-scraper-pp. deepl-scraper-pp2
however preserves newlines in the translated text. Hence, it will make life easier when trying to process large chunks of text. deepl-scraper-pp2
is originally intended for deepl-tr-webui
but can be used elsewhere as well.
Installation
pip install deepl-scraper-pp2
# pip install deepl-scraper-pp2 # upgrade to the latest version
or
poetry add deepl-scraper-pp2
# poetry add deepl-scraper-pp2@latest # upgrade to the latest version
or clone the repo (git clone https://github.com/ffreemt/deepl-scraper-pyppeteer2.git
) and install from it.
Usage
in python
import asyncio
from deepl_scraper_pp2.deepl_tr import deepl_tr
print(asyncio.run(deepl_tr("test 1 \n\n test 2"))
# '测试1 \n\n 测试2'
Or start a local server
uvicorn deepl_scraper_pp2.deepl_server:app
# or
python -m deepl_scraper_pp2.run_uvicorn
and consume the REST API
res = requests.post(
"http://127.0.0.1:8000/text",
json={
"text": "test 1\n\ntest2",
"to_lang": "zh"},
headers={"accept": "application/json", "Content-Type": "application/json"}
)
print(res.json())
# {'q': {'text': 'test 1\n\ntest2', 'from_lang': None, 'to_lang': 'zh', 'description': None}, 'result': '测试1\n\n测试2'}
Consult http://127.0.0.1:8000/docs for details.
Disclaimer
The pypi is beta and will likely remain beta -- use it at your own peril.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for deepl-scraper-pp2-0.1.0a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dc7fa104465262c9777b0aed3d7a07285da1b02b0e174a1d8cf63a39ae3b4a1 |
|
MD5 | 1b30cdb0977334bf0e05f022d458b30b |
|
BLAKE2b-256 | a606140076a4226e7f75a4db45310a4ca0aa6e800d5957315dc49c5465fbba1d |
Hashes for deepl_scraper_pp2-0.1.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87a387723cfa334934dfc696bde8f3f5b747481a92d6d646615cfef53c435260 |
|
MD5 | 40b6c0a18d5ee2fd28ea746dbca2ad3d |
|
BLAKE2b-256 | cd26bf10c6f720d3ca3a47b22a9fa24195e361b2350e1d19d33f31690bee2596 |