scrape deepl via pyppeteer
Project description
deepl-scraper-pp
scrape deepl using pyppeteer, cross platform (Windows/MacOS/Linux)
Installation
pip install deepl-scraper-pp
# pip install deepl-scraper-pp # upgrade to the latest version
or
poetry add deepl-scraper-pp
# poetry add deepl-scraper-pp@latest # upgrade to the latest version
or clone the repo (git clone https://github.com/ffreemt/deepl-scraper-pyppeteer.git
) and install from it.
Usage
In an ipython
session:
# ipython
from deepl_scraper_pp.deepl_tr import deepl_tr
res = await deepl_tr("test me")
print(res)
# '考我 试探我 测试我 试探'
print(await deepl_tr("test me", to_lang="de"))
# mich testen mich prüfen testen Sie mich
text = "Pyppeteer has almost same API as puppeteer. More APIs are listed in the document"
print(await deepl_tr(text, to_lang="zh"))
# Pyppeteer的API与puppeteer几乎相同。更多的API在文档中列出。
in python
import asyncio
from deepl_scraper_pp.deepl_tr import deepl_tr
async def main():
text1 = "test me"
text2 = "Pyppeteer has almost same API as puppeteer. More APIs are listed in the document"
coros = [deepl_tr(elm) for elm in [text1, text2]]
res = await asyncio.gather(*coros, return_exceptions=True)
print(res)
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(main())
finally:
loop.close()
# output: ['考我 试探我 测试我 试探', 'Pyppeteer的API与puppeteer几乎相同。更多的API在文档中列出']
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
deepl-scraper-pp-0.1.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for deepl_scraper_pp-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8532e2ad0e7d2344aabf4411767325e0d50f817651483bde9726ea0cc8d53e26 |
|
MD5 | 0fe9e08a3d3f8249e813d2f7da06b46a |
|
BLAKE2b-256 | 4302e66d705eb9effa1daa5be1afc4580448fdff6fbcbeb6c918b9c4ea189e7e |