質問

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

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top