项目作者: ApexDevelopment

项目描述 :
No-BS Imgur search.
高级语言: JavaScript
项目地址: git://github.com/ApexDevelopment/imgur-grab.git
创建时间: 2020-09-10T07:04:08Z
项目社区:https://github.com/ApexDevelopment/imgur-grab

开源协议:

下载


imgur-grab: No-BS Imgur searching.

npm i ApexDevelopment/imgur-grab

This is a package that allows for easy scraping of Imgur search results (so no API key is needed). It is meant for simple hobby projects and should not be used in production! A simple change to Imgur’s frontend HTML could break this.

How to use

Using imgur-grab is simple:

  1. const imgur = require("imgur-grab");
  2. // "imgur" is a function that takes a search query:
  3. imgur("puppies").then((results) => {
  4. // "results" is an array of links to the raw images
  5. // For example, https://i.imgur.com/someimage.png
  6. for (let result of results) {
  7. console.log(result);
  8. }
  9. }).catch((err) => {
  10. console.log(err);
  11. });

That’s it! There are no options to configure. The results are exactly what you would get by visiting Imgur and typing something into the search box. Results are limited to only the first page. This should be sufficient for, say, a Discord bot with an image search command.