google-translate-api icon indicating copy to clipboard operation
google-translate-api copied to clipboard

Which `http-proxy-agent` package do you use?

Open XiaoxiaYao opened this issue 1 year ago • 6 comments

Привет, I could not find createHttpProxyAgent in the package. Which lib are you using?

I am using HttpProxyAgent for now. But the generated agent seems not working with your lib. Your lib is using an old agent somehow. image

XiaoxiaYao avatar Oct 09 '23 14:10 XiaoxiaYao

Hi! I was using http-proxy-agent 5.x where createHttpProxyAgent was defined. Now updated examples and readme for using 7.x with HttpProxyAgent class. Thank you!

vitalets avatar Oct 09 '23 15:10 vitalets

Is the proxy working for you? I use the same code. But it seems like the lib is not using the proxy ip, it's using my local ip.

XiaoxiaYao avatar Oct 09 '23 15:10 XiaoxiaYao

Is the proxy working for you? I use the same code. But it seems like the lib is not using the proxy ip, it's using my local ip.

Yes, works for me. Could you try this?

$ npx ts-node-esm examples/with-proxy.ts 163.53.18.119:80
Using proxy: 163.53.18.119:80
Translating: Ich muss Deutsch lernen!
Result: I have to learn German!

vitalets avatar Oct 09 '23 15:10 vitalets

Yep. I tried. Still not working. No one faces this issue besides me? 😓 image

XiaoxiaYao avatar Oct 09 '23 23:10 XiaoxiaYao

Interesting. Could you try this snippet to check HttpProxyAgent in isolation?:

import { HttpProxyAgent } from 'http-proxy-agent';
import fetch from 'node-fetch';

main();

async function main() {
  console.log('without proxy');
  const res1 = await fetch('https://www.httpbin.org/ip');
  console.log(await res1.text());

  console.log('with proxy');
  const agent = new HttpProxyAgent(`http://133.18.234.13:80`); // maybe proxy needs to be replaced with fresher one
  const res2 = await fetch('https://www.httpbin.org/ip', { agent });
  console.log(await res2.text());
}

My output is:

without proxy
{
  "origin": "xx.xxx.83.147"
}

with proxy
{
  "origin": "133.18.234.13"
}

vitalets avatar Oct 13 '23 08:10 vitalets

also meet this problem.

innocces avatar Aug 29 '24 08:08 innocces