LuanRT / google-this

A simple yet powerful module to retrieve organic search results and much more from Google.
https://www.npmjs.com/package/googlethis
MIT License
320 stars 77 forks source link

Allow passing of axios_config #29

Closed gregpriday closed 1 year ago

gregpriday commented 2 years ago

Description

This PR is fairly simple. It just gives you the ability to pass extra axios_config in the options parameter. The

It Fixes https://github.com/LuanRT/google-this/issues/21 by allowing you to pass proxy servers.

import SocksProxyAgent from 'socks-proxy-agent';

const httpsAgent = new SocksProxyAgent.SocksProxyAgent(...);
const options = {
  page: 0,
  safe: false,
  additional_params: {
    hl: 'en'
  },
  axios_config: {
    timeout: 15000,
    proxy: false,
    httpsAgent: httpsAgent
  }
}

const response = await google.search('how do you scrape google results?', options);

It should support standard HTTPS proxies, too. I just generally use Socks5.

Type of change

Please delete options that are not relevant.

Checklist:

gregpriday commented 2 years ago

If this looks good, I'll finish other items on the checklist. Adding tests and documentation. It's a minor change though.

LuanRT commented 2 years ago

Sweet! And yup I agree, you don't have to add tests for this particular change. Left a review.

Thanks again!

github-actions[bot] commented 1 year ago

This PR has been automatically marked as stale because it has not had recent activity. Remove the stale label or comment or this will be closed in 2 days