문제

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