Candroid Candroid - 1 year ago 106
Node.js Question

Request a GET failed in Node

I am requesting a

to a 3rd party api service from my

I am getting a response of
403 forbidden

request(",image,id&format=json&limit=1&query=street%20fighter%203&resources=game",(err,res,body) => {

Querying the same request in my browser return the expected results.

Any idea why this can happen?


Logging the response body, I receive the following page (without the JS):

<h1>Wordpress RSS Reader, Anonymous Bot or Scraper Blocked</h1>
Sorry we do not allow WordPress plugins to scrape our site. They tend to be used maliciously to steal our content. We do not allow scraping of any kind.
You can load our RSS feeds using any other reader but you may not download our content.
<a href='/feeds'>Click here more information on our feeds</a>
Or you're running a bot that does not provide a unique user agent.
Please provide a UNIQUE user agent that describes you. Do not use a default user agent like "PHP", "Java", "Ruby", "wget", "curl" etc.
You MUST provide a UNIQUE user agent. ...and for God's sake don't impersonate another bot like Google Bot that will for sure
get you permanently banned.
Or.... maybe you're running an LG Podcast player written by a 10 year old. Either way, Please stop doing that.

Answer Source

this service requires User-Agent in headers, see this example

const rp = require('request-promise')

const options = {
  method: 'GET',
  uri: ',image,id&format=json&limit=1&query=street%20fighter%203&resources=game',
  headers: { 'User-Agent': 'test' },
  json: true

  .then(result => {
    // process result
  .catch(e => {
    // handle error
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download