misobarisic / redgifs-downloader

Downloading videos from RedGIFs has never been easier
https://www.npmjs.com/package/redgifs-downloader
MIT License
47 stars 3 forks source link

Not sure what I'm doing wrong. #14

Closed Rootkit- closed 2 years ago

Rootkit- commented 2 years ago

` W:\down\py\redgifs-downloader>node sad.js [onInit] { userMode: false, query: 'Teen', useMobile: false, skipExisting: false, date: 2022-01-20T21:00:02.690Z } Error: Request failed with status code 400 at createError (W:\down\py\redgifs-downloader\node_modules\redgifs-downloader\dist\lib.js:568:15) at settle (W:\down\py\redgifs-downloader\node_modules\redgifs-downloader\dist\lib.js:584:12) at IncomingMessage.handleStreamEnd (W:\down\py\redgifs-downloader\node_modules\redgifs-downloader\dist\lib.js:2743:11) at IncomingMessage.emit (node:events:341:22) at endReadableNT (node:internal/streams/readable:1294:12) at processTicksAndRejections (node:internal/process/task_queues:80:21) { config: { url: 'gifs/search?search_text=Teen&count=150&order=trending', method: 'get', headers: { Accept: 'application/json, text/plain, /', 'User-Agent': 'axios/0.21.4' }, baseURL: 'https://api.redgifs.com/v2/', transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 10000, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, data: undefined }, request: <ref 1> ClientRequest { _events: [Object: null prototype] { socket: [Function (anonymous)], abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], error: [Function (anonymous)], timeout: [Function (anonymous)], prefinish: [Function: requestOnPrefinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, secureConnecting: false, _SNICallback: null, servername: 'api.redgifs.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 10, connecting: false, _hadError: false, _parent: null, _host: 'api.redgifs.com', _readableState: [ReadableState], _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: undefined, _server: null, ssl: [TLSWrap], _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular 1], timeout: 10000,

  [Symbol(verified)]: true,
  [Symbol(pendingSession)]: null,
  [Symbol(async_id_symbol)]: 7,
  [Symbol(kHandle)]: [TLSWrap],
  [Symbol(kSetNoDelay)]: false,
  [Symbol(lastWriteQueueSize)]: 0,
  [Symbol(timeout)]: Timeout {
    _idleTimeout: 10000,
    _idlePrev: [TimersList],
    _idleNext: [TimersList],
    _idleStart: 282,
    _onTimeout: [Function: bound ],
    _timerArgs: undefined,
    _repeat: null,
    _destroyed: false,
    [Symbol(refed)]: false,
    [Symbol(kHasPrimitive)]: false,
    [Symbol(asyncId)]: 16,
    [Symbol(triggerId)]: 11
  },
  [Symbol(kBuffer)]: null,
  [Symbol(kBufferCb)]: null,
  [Symbol(kBufferGen)]: null,
  [Symbol(kCapture)]: false,
  [Symbol(kBytesRead)]: 0,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(connect-options)]: [Object],
  [Symbol(RequestTimeout)]: undefined
},
_header: 'GET /v2/gifs/search?search_text=Teen&count=150&order=trending HTTP/1.1\r\n' +
  'Accept: application/json, text/plain, */*\r\n' +
  'User-Agent: axios/0.21.4\r\n' +
  'Host: api.redgifs.com\r\n' +
  'Connection: close\r\n' +
  '\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
  _events: [Object: null prototype],
  _eventsCount: 2,
  _maxListeners: undefined,
  defaultPort: 443,
  protocol: 'https:',
  options: [Object],
  requests: {},
  sockets: [Object],
  freeSockets: {},
  keepAliveMsecs: 1000,
  keepAlive: false,
  maxSockets: Infinity,
  maxFreeSockets: 256,
  scheduling: 'fifo',
  maxTotalSockets: Infinity,
  totalSocketCount: 1,
  maxCachedSessions: 100,
  _sessionCache: [Object],
  [Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/v2/gifs/search?search_text=Teen&count=150&order=trending',
_ended: true,
res: IncomingMessage {
  _readableState: [ReadableState],
  _events: [Object: null prototype],
  _eventsCount: 3,
  _maxListeners: undefined,
  socket: [TLSSocket],
  httpVersionMajor: 1,
  httpVersionMinor: 1,
  httpVersion: '1.1',
  complete: true,
  rawHeaders: [Array],
  rawTrailers: [],
  aborted: false,
  upgrade: false,
  url: '',
  method: null,
  statusCode: 400,
  statusMessage: 'Bad Request',
  client: [TLSSocket],
  _consuming: true,
  _dumped: false,
  req: [Circular *1],
  responseUrl: 'https://api.redgifs.com/v2/gifs/search?search_text=Teen&count=150&order=trending',
  redirects: [],
  [Symbol(kCapture)]: false,
  [Symbol(kHeaders)]: [Object],
  [Symbol(kHeadersCount)]: 32,
  [Symbol(kTrailers)]: null,
  [Symbol(kTrailersCount)]: 0,
  [Symbol(RequestTimeout)]: undefined
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'api.redgifs.com',
protocol: 'https:',
_redirectable: Writable {
  _writableState: [WritableState],
  _events: [Object: null prototype],
  _eventsCount: 3,
  _maxListeners: undefined,
  _options: [Object],
  _ended: true,
  _ending: true,
  _redirectCount: 0,
  _redirects: [],
  _requestBodyLength: 0,
  _requestBodyBuffers: [],
  _onNativeResponse: [Function (anonymous)],
  _currentRequest: [Circular *1],
  _currentUrl: 'https://api.redgifs.com/v2/gifs/search?search_text=Teen&count=150&order=trending',
  _timeout: null,
  [Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
  accept: [Array],
  'user-agent': [Array],
  host: [Array]
}

}, response: { status: 400, statusText: 'Bad Request', headers: { date: 'Thu, 20 Jan 2022 21:00:03 GMT', 'content-type': 'application/json', 'transfer-encoding': 'chunked', connection: 'close', 'cache-control': 'no-store', 'access-control-allow-origin': '', 'access-control-allow-headers': 'Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type', 'access-control-allow-methods': 'GET, PUT, POST, DELETE, HEAD, OPTIONS, PATCH', 'access-control-max-age': '86400', 'cf-cache-status': 'MISS', 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'strict-transport-security': 'max-age=2592000; includeSubDomains; preload', 'x-content-type-options': 'nosniff', server: 'cloudflare', 'cf-ray': '6d0b3ae65bcdc53c-ORD', 'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400' }, config: { url: 'gifs/search?search_text=Teen&count=150&order=trending', method: 'get', headers: [Object], baseURL: 'https://api.redgifs.com/v2/', transformRequest: [Array], transformResponse: [Array], timeout: 10000, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], transitional: [Object], data: undefined }, request: <ref 1> ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: [TLSSocket], _header: 'GET /v2/gifs/search?search_text=Teen&count=150&order=trending HTTP/1.1\r\n' + 'Accept: application/json, text/plain, /\r\n' + 'User-Agent: axios/0.21.4\r\n' + 'Host: api.redgifs.com\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/v2/gifs/search?search_text=Teen&count=150&order=trending', _ended: true, res: [IncomingMessage], aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'api.redgifs.com', protocol: 'https:', _redirectable: [Writable],

  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
data: { errorMessage: [Object] }

}, isAxiosError: true, toJSON: [Function: toJSON] } [onStart] { availableFiles: 0, date: 2022-01-20T21:00:02.955Z, numberToDownload: 'not specified', query: 'Teen', userMode: false } [onGetLinks] { links: [], date: 2022-01-20T21:00:02.956Z, options: { useMobile: false, skipExisting: false } } [onFinish] { availableFiles: 0, date: 2022-01-20T21:00:02.958Z, numberToDownload: 'not specified', query: 'Teen', userMode: false }

W:\down\py\redgifs-downloader>`

I'm not entirely bad with code... Making me think its something to do with my end though... Desktop version makes the folder and doesn't download either.

misobarisic commented 2 years ago

It is not your fault.

I have tried testing it myself and it seems like their api is broken. Manually querying this returns no useful data. I had already updated the internal links.js file to reflect the 2021 upgrade.

We just have to wait for them sort their stuff out.

misobarisic commented 2 years ago

On top of all that. Their API no longer supports publicly getting all gifs of a user. What a shame.

DexterHaslem commented 2 years ago

v2/gifs/search appears to be working now? eg, gifs -> urls -> hd has working links. I came across this repo googling something else, but am successfully using these to download all pages of search terms. same goes for v2/users/<username>/search !

misobarisic commented 2 years ago

v2/gifs/search appears to be working now? eg, gifs -> urls -> hd has working links. I came across this repo googling something else, but am successfully using these to download all pages of search terms. same goes for v2/users/<username>/search !

Thanks for the info. I'll test it out when I get the chance.

misobarisic commented 2 years ago

I have pushed a new commit and an update to npm.