LucasLeandro1204 / Pornsearch

Easy way to search for porn content!
MIT License
329 stars 68 forks source link

Ability to check how much pages/results for each search #20

Closed ghost closed 6 years ago

ghost commented 6 years ago

Umm this isn't really like a suggestion that you might be looking for, but like it would be cool if we can check how much pages and number of results each search returns. Like im using it to make it pull out a random webm each search, but if it hits a page number that exceeds the page number, or it hits a number that exceeds the number of search results, it errors lol.

LucasLeandro1204 commented 6 years ago

@DeathPhase It will fail because the page doesn't exists / have any results. You can do something like

let length = 0;
try {
  length = (await Pornsearch.gifs()).length;
} catch (e) {
  //
}

And then do whatever you want with the length (you don't need to use async / await for this, .then and .catch should work fine xd)