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

minWidth and minHeight not working? #15

Closed physis123 closed 2 years ago

physis123 commented 2 years ago

Hi, many thanks for the awesome package.

This code works fine:

const downloader = RedgifsDownloader.create(__dirname)

downloader.addEventListener("onGetLinks", info => {
    console.log("[onGetLinks]", info)
})

downloader.downloadUser('xkliper', {numberToDownload: 1});

and returns:

[onGetLinks] {
  links: [
    {
      id: 'brilliantfamiliarhyracotherium',
      createDate: 1662280457,
      hasAudio: true,
      width: 1920,
      height: 1080,
      likes: 0,
      tags: [Array],
      verified: false,
      views: 23,
      duration: 57.166,
      published: true,
      urls: [Object],
      userName: 'xkliper',
      type: 1,
      avgColor: '#000000',
      gallery: null,
      hideHome: false,
      hideTrending: false
    }
  ],
  date: 2022-09-05T17:02:14.252Z,
  options: { numberToDownload: 1, useMobile: false, skipExisting: false }

However, changing the final line to:

downloader.downloadUser('xkliper', {numberToDownload: 1, minWidth: 500});

Returns no links:

[onGetLinks] {
  links: [],
  date: 2022-09-05T17:03:45.457Z,
  options: {
    numberToDownload: 1,
    minWidth: 500,
    useMobile: false,
    skipExisting: false
  }
}

I would expect it to return the same link as the first example, where the width is 1920 (above the minWidth of 500).

It seems like any use of minWidth, minHeight, maxWidth, and maxHeight prevents any links from being found, regardless of values.

Setting useMobile to true doesn't make any difference:

downloader.downloadUser('xkliper', {numberToDownload: 1, useMobile:true, maxHeight: 5000});

Any ideas?

misobarisic commented 2 years ago

Thanks for the finding. 😃 I'll look into it.

misobarisic commented 2 years ago

I've pushed a new commit and released v2.1.1 to comply with the changes of the API response.

physis123 commented 2 years ago

Thanks for the very quick fix!

It's working now!