Question

The page I'm scrapping is detecting whether the request is ajax or simple one. How can I specify that ?

app.get('/gsb', function(res, req){
request({
    method: 'POST',
    url: "https://www.somesite.com/somepage/"
} ...

Now, this somepage detects whether its xhr or not.

Thanks

Était-ce utile?

La solution

AJAX is typically indicated via the X-Requested-With header in the request.

request({
  method: 'POST',
  headers: {'X-Requested-With': 'XMLHttpRequest'},
  url: ...})

Try that and see if it does the trick.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top