Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

baidu translate for free

Project description

baidu-tr-free Python3.6 packageCodecovPyPI version

Baidu translate for free -- local cache plus throttling. Let's hope it lasts.

Broken or not

Python3.6 package: failing indicates broken. In case of failing, try the following workaround: log in to first. Then use the Chrome browser to visit, press F12 and then ctr-R (or any method) to open devtools' Network tab and reload. Locate and obtain the BAIDUID and token strings in the headers. Plug in the BAIDUID and token strings to lines 66-67 in the file


  • Text longer than 30 characters can be handled now.
  • Auto-fetching BAIDUID and TOKEN


pip install -U baidu-tr-free or

  • install (pip or whatever) necessary requirements, e.g. pip install js2py requests_cache jsonpath_rw or pip install -r requirements.txt
  • Drop the file in any folder in your PYTHONPATH (check with import sys; print(sys.path)
    • Several valid TOKEN/BAIDUID are included.
  • or clone the repo (e.g., git clone or download and unzip) and change to the baidu-tr-free folder and do a python develop


Log in to using Chrome: bdtr needs the cookies info (BAIDUID) from the Chrome browser on

from bdtr import bdtr
print(bdtr('hello world'))  # -> '你好,世界'
print(bdtr('hello world', to_lang='de'))  # ->'Hallo Welt'
print(bdtr('hello world', to_lang='jp'))  # ->'ハローワールド'

to_lang='fr' does not seem to work tho.

Validation and Pressure Tests

  • pip install pytest
  • pytest
    • Average delay for throttling set to 0.6 s, ajdust as needed


  • Thanks to everyone whose code was used
  • JS_SIGN (javascript code for signing) can be found on the net. It's also not too difficult to obtain some similar code from Chrome's devtools.

Project details

Download files

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

Files for baidu-tr-free, version 0.0.10
Filename, size File type Python version Upload date Hashes
Filename, size baidu_tr_free-0.0.10-py3-none-any.whl (13.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size baidu-tr-free-0.0.10.tar.gz (10.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page