matthewmueller / x-ray

The next web scraper. See through the <html> noise.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

adding proxy to x-ray node js

bassemAmous opened this issue · comments

Subject of the issue

Describe your issue here.

Your environment

  • version of node: run node --version
  • version of npm: run npm --version

Steps to reproduce

Tell us how to reproduce this issue.

Expected behaviour

Tell us what should happen.

Actual behaviour

Tell us what happens instead.

I am developing a node js application and I am scraping a web site using x-ray and I think the blocked my ip address so how can I configure a proxy or hide my Ip address for that ? here is my code:

var Xray = require('x-ray');
var x = Xray()
x('https://www.myurl.com',  {


    title: x('#cm_cr-review_list .a-section.review', [{,
        blogs:"..a-text-bold"
    }]),
})
    .paginate('li.a-l a@href')
    .write('result.json')
commented

@gebrits Thank you for your answer but I didn't really understand the second part could you please send me an example for that ?

commented

Something like this. Untested: (second option in the comments)

https://gist.github.com/gebrits/57689768eceaec43ae0ddd17949d7503

Thank you I just resolved the problem.