0

all my request return state code 403 yet through the the mother-website it doesn't.

this is for a node.js based code piece.

modules i used: fs, request

const request = require('request')
const fs = require('fs')

let file = fs.createWriteStream('./try.jpg')

request('https://ba.hitomi.la/galleries/1402385/33_31.jpg', { encoding: null, headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'origin, x-requested-with, content-type, accept' } }, (error, response, body) => {
}).pipe(file)

i need an full code that can download / fetching data through the website.

Sombian
  • 33
  • 1
  • 5
  • 401 means there is no authentication, so, you need to pass some auth data in your headers https://stackoverflow.com/a/6937030/6066986 – Grynets Apr 22 '19 at 07:18
  • @Grynets sorry, just edited. it was 403. – Sombian Apr 22 '19 at 22:29
  • CORS is managed on the server, setting `Access-Control-Allow-Origin` in the client request has no effect and is likely ignored by the server. CORS isn't even relevant outside of a web browser. – Jake Holzinger Apr 22 '19 at 22:43

0 Answers0