mrdotb/yifysubtitles

Response code 403 (Forbidden)

Opened this issue · 1 comments

I got this error while testing this code:
`const yifysubtitles = require('yifysubtitles')

const getSubs = async () => {
try{
const results = await yifysubtitles('tt1375666', {
path: '/subs',
langs: ['ar']
})
}catch(err){
console.error('error: ', err)
}
}
getSubs()`

full error body:

GotError [HTTPError]: Response code 403 (Forbidden)
at EventEmitter. (E:\WebDev\Node\subs\node_modules\got\source\as-promise.js:74:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
host: 'www.yifysubtitles.com',
hostname: 'www.yifysubtitles.com',
method: 'GET',
path: '/movie-imdb/tt1375666',
socketPath: undefined,
protocol: 'https:',
url: 'https://www.yifysubtitles.com/movie-imdb/tt1375666',
gotOptions: {
path: '/movie-imdb/tt1375666',
protocol: 'https:',
slashes: true,
auth: null,
host: 'www.yifysubtitles.com',
port: null,
hostname: 'www.yifysubtitles.com',
hash: null,
search: null,
query: null,
pathname: '/movie-imdb/tt1375666',
href: 'https://www.yifysubtitles.com/movie-imdb/tt1375666',
retry: {
retries: [Function (anonymous)],
methods: [Set],
statusCodes: [Set],
errorCodes: [Set]
},
headers: {
'user-agent': 'got/9.6.0 (https://github.com/sindresorhus/got)',
'accept-encoding': 'gzip, deflate'
},
hooks: {
beforeRequest: [],
beforeRedirect: [],
beforeRetry: [],
afterResponse: [],
beforeError: [],
init: []
},
decompress: true,
throwHttpErrors: true,
followRedirect: true,
stream: false,
form: false,
json: false,
cache: false,
useElectronNet: false,
method: 'GET'
},
statusCode: 403,
statusMessage: 'Forbidden',
headers: {
date: 'Sun, 25 Jul 2021 10:53:59 GMT',
'content-type': 'text/html',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Accept-Encoding',
'cf-cache-status': 'DYNAMIC',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'report-to': '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=LU8kcWWCvUqWVcVzvj0TgXa0Q77menyXpA40hAJFrPvGXwUXUT4tD6qq%2BtWIup1wHiVXuWGYy6A7kkXFCguPhkZ9%2FVEQrbVKfF6cIJmiBEtvu4tiQFr3DKDdKJgizUkOe5BD%2F4a3cj0%3D"}],"group":"cf-nel","max_age":604800}',
nel: '{"report_to":"cf-nel","max_age":604800}',
server: 'cloudflare',
'cf-ray': '6744d8fe8fb91141-MAD',
'content-encoding': 'gzip',
'alt-svc': 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400'
},
body: '\r\n' +
'<title>403 Forbidden</title>\r\n' +
'\r\n' +
'

403 Forbidden

\r\n' +
'
openresty\r\n' +
'\r\n' +
'\r\n'
}

It appear there is a problem with the change of url from .com to .org I don't have the time to fix it now. You can check and pr.