Skip to main content

scrape deepl via pyppeteer2 with para info

Project description

deepl-scraper-pp2

[tests]pythonCode style: blackLicense: MITPyPI version

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

import requests
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


Download files

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

Source Distribution

deepl-scraper-pp2-0.1.0a2.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

deepl_scraper_pp2-0.1.0a2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file deepl-scraper-pp2-0.1.0a2.tar.gz.

File metadata

  • Download URL: deepl-scraper-pp2-0.1.0a2.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.8.10 Windows/10

File hashes

Hashes for deepl-scraper-pp2-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 770a3befcc5f39ac4d983d3290c9d4b4bfcc20b9e48436534ff154d7ccea1974
MD5 440c248a76e1612e9890dda826d10060
BLAKE2b-256 19914bb6da3d89234a5c149d8995f0b4f65ec3df77d00dc2289d9aea6a635d2b

See more details on using hashes here.

File details

Details for the file deepl_scraper_pp2-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for deepl_scraper_pp2-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ab6fead4a86d607c904585ee070db2a20a56ba38e38c8418f99adbc8b584362
MD5 cba52b3ade8b06708231c44265e34475
BLAKE2b-256 63cefd1e8019379ee495191934fb8a380eaed750dcf8a83c1f808c04efdf9589

See more details on using hashes here.

Supported by

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