se-scraper/examples/proxies.js

31 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-06-11 18:16:59 +02:00
const se_scraper = require('./../src/node_scraper.js');
2019-06-11 18:16:59 +02:00
(async () => {
let browser_config = {
debug_level: 1,
output_file: 'examples/results/proxyresults.json',
log_ip_address: true,
2019-06-12 21:25:20 +02:00
// a file with one proxy per line. Example:
// socks5://78.94.172.42:1080
// http://118.174.233.10:48400
proxy_file: '/home/nikolai/.proxies', // one proxy per line
// whether to use proxies only
// when this is set to true, se-scraper will not use
// your default IP address in a browser
use_proxies_only: true,
2019-06-11 18:16:59 +02:00
};
2019-06-11 18:16:59 +02:00
let scrape_job = {
search_engine: 'google',
keywords: ['news', 'scrapeulous.com', 'incolumitas.com', 'i work too much', 'what to do?', 'javascript is hard'],
num_pages: 1,
};
2019-06-11 18:16:59 +02:00
var scraper = new se_scraper.ScrapeManager(browser_config);
await scraper.start();
var results = await scraper.scrape(scrape_job);
console.dir(results, {depth: null, colors: true});
await scraper.quit();
})();