{"id":20885892,"url":"https://github.com/zotero/translation-server","last_synced_at":"2025-04-04T14:06:24.990Z","repository":{"id":1012567,"uuid":"136916998","full_name":"zotero/translation-server","owner":"zotero","description":"A Node.js-based server to run Zotero translators","archived":false,"fork":false,"pushed_at":"2025-02-13T06:29:55.000Z","size":556,"stargazers_count":129,"open_issues_count":46,"forks_count":54,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-28T13:07:17.035Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zotero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-11T11:28:53.000Z","updated_at":"2025-02-23T11:51:43.000Z","dependencies_parsed_at":"2023-02-13T03:05:35.492Z","dependency_job_id":"fb50d9ee-23e8-4e19-8d36-0ab81bf48b5d","html_url":"https://github.com/zotero/translation-server","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotero%2Ftranslation-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotero%2Ftranslation-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotero%2Ftranslation-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotero%2Ftranslation-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zotero","download_url":"https://codeload.github.com/zotero/translation-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190231,"owners_count":20898700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T08:14:56.486Z","updated_at":"2025-04-04T14:06:24.974Z","avatar_url":"https://github.com/zotero.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zotero Translation Server\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/zotero/translation-server/ci.yml?branch=master)](https://github.com/zotero/translation-server/actions)\n\n\nThe Zotero translation server lets you use [Zotero translators](https://www.zotero.org/support/translators) without the Zotero client.\n\n## Installation\n\n### Running via Docker\n\nThe easiest way to run a local instance of translation-server is via Docker.\n\n```\ndocker pull zotero/translation-server\ndocker run -d -p 1969:1969 --rm --name translation-server zotero/translation-server\n```\n\nThis will pull the latest image [from Docker Hub](https://registry.hub.docker.com/r/zotero/translation-server)\nand run it as a background process on port 1969. Use `docker kill translation-server` to stop it.\n\n### Running from source\n\nFirst, fetch the source code and install Node dependencies:\n\n1. `git clone --recurse-submodules https://github.com/zotero/translation-server`\n\n1. `cd translation-server`\n\n1. `npm install`\n\nOnce you've set up a local copy of the repo, you can run the server in various ways:\n\n#### Node.js\n\n`npm start`\n\n#### Docker (development)\n\nBuild from the local repo and run in foreground:\n\n```\ndocker build -t translation-server .\ndocker run -ti -p 1969:1969 --rm translation-server\n```\n\n#### AWS Lambda\n\ntranslation-server can also run on AWS Lambda and be accessed through API Gateway. You will need the [AWS SAM CLI](https://docs.aws.amazon.com/lambda/latest/dg/sam-cli-requirements.html) to deploy the server.\n\nCopy and configure config file:\n```\ncp lambda_config.env-sample lambda_config.env\n```\n\nTest locally:\n```\n./lambda_local_test lambda_config.env\n```\n\nDeploy:\n```\n./lambda_deploy lambda_config.env\n```\n\nYou can view the API Gateway endpoint in the Outputs section of the console output.\n\n## User-Agent\n\nBy default, translation-server uses a standard Chrome `User-Agent` string to maximize compatibility. This is fine for personal usage, but for a deployed service, it’s polite to customize `User-Agent` so that sites can identify requests and contact you in case of abuse.\n\nYou can do this by setting the `USER_AGENT` environment variable:\n\n`USER_AGENT='my-custom-translation-server/2.0 (me@example.com)' npm start`\n\nIf you find that regular requests are being blocked with a fully custom user-agent string, you can also add an identifier and contact information to the end of a standard browser UA string:\n\n```\nexport USER_AGENT='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 my-custom-translation-server/2.0 (me@example.com)'\nnpm start\n```\n\n## Proxy Support\n\nYou can configure translation-server to use a proxy server by setting the `HTTP_PROXY` and `HTTPS_PROXY` environment variables:\n\n`HTTP_PROXY=http://proxy.example.com:8080 HTTPS_PROXY=http://proxy.example.com:8080 npm start`\n\nIf your proxy server uses a self-signed certificate, you can set `NODE_TLS_REJECT_UNAUTHORIZED=0` to force Node to ignore certificate errors.\n\nIt’s also possible to opt out of proxying for specific hosts by using the `NO_PROXY` variable. See the [Node `request` library documentation](https://github.com/request/request#controlling-proxy-behaviour-using-environment-variables) for more details.\n\n## Running tests\n\n`npm test`\n\n## Endpoints\n\n### Web Translation\n\n#### Retrieve metadata for a webpage:\n\n```\n$ curl -d 'https://www.nytimes.com/2018/06/11/technology/net-neutrality-repeal.html' \\\n   -H 'Content-Type: text/plain' http://127.0.0.1:1969/web\n```\n\nReturns an array of translated items in Zotero API JSON format\n\n#### Retrieve metadata for a webpage with multiple results:\n\n```\n$ curl -d 'https://www.ncbi.nlm.nih.gov/pubmed/?term=crispr' \\\n   -H 'Content-Type: text/plain' http://127.0.0.1:1969/web\n```\n\nReturns `300 Multiple Choices` with a JSON object:\n\n```\n{\n\t\"url\": \"https://www.ncbi.nlm.nih.gov/pubmed/?term=crispr\",\n\t\"session\": \"9y5s0EW6m5GgLm0\",\n\t\"items\": {\n\t\t\"u30044970\": {\n\t\t\t\"title\": \"RNA Binding and HEPN-Nuclease Activation Are Decoupled in CRISPR-Cas13a.\"\n\t\t},\n\t\t\"u30044923\": {\n\t\t\t\"title\": \"Knockout of tnni1b in zebrafish causes defects in atrioventricular valve development via the inhibition of the myocardial wnt signaling pathway.\"\n\t\t},\n\t\t// more results\n\t}\n}\n```\n\nTo make a selection, delete unwanted results from the items object and POST the returned data back to the server as `application/json`.\n\n\n### Search Translation\n\nRetrieve metadata from an identifier (DOI, ISBN, PMID, arXiv ID):\n\n```\n$ curl -d 10.2307/4486062 -H 'Content-Type: text/plain' http://127.0.0.1:1969/search\n```\n\n### Export Translation\n\nConvert items in Zotero API JSON format to a [supported export format](https://github.com/zotero/translation-server/blob/master/src/formats.js) (RIS, BibTeX, etc.):\n\n```\n$ curl -d @items.json -H 'Content-Type: application/json' 'http://127.0.0.1:1969/export?format=bibtex'\n```\n\n### Import Translation\n\nConvert items in any [import format](https://www.zotero.org/support/kb/importing_standardized_formats)\nto the Zotero API JSON format:\n\n```\n$ curl --data-binary @data.bib -H 'Content-Type: text/plain' http://127.0.0.1:1969/import\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzotero%2Ftranslation-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzotero%2Ftranslation-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzotero%2Ftranslation-server/lists"}