lauti7 / image-extractor-api

Given the URL of the page, list all the images that are being used and allow the user to download them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Extractor - API Build Status

API for Image Extractor - Client

Given the URL of the page, list all the images that are being used and allow the user to download them.

API is online here and its browser client is online here

Built with:

Typescript, Express, and Cheerio (will be replaced for Puppeteer). I am using TravisCI for CI/CD

API allows user to:

  • Get all images from any public website (server side render).
  • Download an image from its link

API:

Get all images links from website

Request

POST /api/extract/

Response

Array of links

{"images": []}

Download single image

Request

GET /api/download/single?weburl={IMAGE_LINK}

Response

Returns the image. If you make a request from your browser, the image will be displayed.

In order to force downloading:

Request

GET /api/download/single?weburl={IMAGE_LINK}&forceDownload=true

Response

Image will be automatically downloaded.

Instalation

You should have Node JS and NPM installed on your PC.

git clone https://github.com/lauti7/image-extractor-api.git
cd image-extractor-api
npm install
touch .env

vim .env

NODE_ENV=development
PORT={YOUR_PORT}

TODOs:

  • Replace Cheerio for Puppeteer.
  • Support for client side render sites.
  • Add endpoints for downloading scrapped images.
  • Allow users to download an optimized version of each scrapped image.
  • Add tests.
  • Add Redis cache.
  • Dockerize it.

About

Given the URL of the page, list all the images that are being used and allow the user to download them.

License:MIT License


Languages

Language:TypeScript 99.3%Language:JavaScript 0.6%Language:Shell 0.1%