Git Product home page Git Product logo

ml-image-searcher's Introduction

ml-image-searcher

license npm downloads npm npm npm bundle size

NodeJS module NPM package that helps to search for images using instagram hashtags and machine learning object recognition technology.

Disclaimer 1

This package was created in 2019 and was depending on ?__a=1, at that time instagram allows the usage of /?__a=1&is_video=true but now instagram no longer allows this and also not allows fetch profiles info without auth session.
Maybe in the future I will implement a scrapping-based solution for this package.

Disclaimer 2

Instagram has gone to great lengths to prevent scraping and other unauthorized access to their public content. This module is dependant on the markup the public-facing instagram.com. Should that change this module might also stop working as intended. You should take this into consideration when deciding whether this module will work for you.

Motivation

In example below output shows how searching using:

  • Human hashtags + ML: 20(cats) / 20(total result) -> [100% correct]
  • Human hashtags : 12(cats) / 20(total result) -> [60% correct]

Installation

npm i ml-image-searcher

Usage

note: there are some limitation of loading instagram data, but it still usefull in most cases :)

Search for cats photos using human hashtags + machine learning prediction

const IG = require('ml-image-searcher');

IG.getImages('cat').then((ret) => console.log(ret.filteredData))

Output (format: htmlAll) response:

  • Left: Human hashtags + ML
  • Right: Human hashtags only

Output (format: filteredData) response:

{ "node":
     { "comments_disabled": false,
       "__typename": "GraphImage",
       "id": "2166483334784860896",
       "edge_media_to_caption": "[Object]",
       "shortcode": "B4Q5R1Np8Lg",
       "edge_media_to_comment": "[Object]",
       "taken_at_timestamp": 1572484960,
       "dimensions": "[Object]",
       "display_url":
        "https://instagram.fatz1-1.fna.fbcdn.net/vp/a7d0f86a15a5d4830f08263741c057ec/5E3E0F4B/t51.2885-15/e35/76909697_2616077041746584_1323244633407869990_n.jpg?_nc_ht=instagram.fatz1-1.fna.fbcdn.net&_nc_cat=108",
       "edge_liked_by": "[Object]",
       "edge_media_preview_like": "[Object]",
       "owner": "[Object]",
       "thumbnail_src":
        "https://instagram.fatz1-1.fna.fbcdn.net/vp/620528b4197d036abda248ccbe36697e/5E61A8F1/t51.2885-15/sh0.08/e35/s640x640/76909697_2616077041746584_1323244633407869990_n.jpg?_nc_ht=instagram.fatz1-1.fna.fbcdn.net&_nc_cat=108",
       "thumbnail_resources": "[Array]",
       "is_video": false,
       "accessibility_caption": "Image may contain: cat" } },
  { "node":
     { "comments_disabled": false,
       "__typename": "GraphImage",
       "id": "2166483275533936833",
       "edge_media_to_caption": "[Object]",
       "shortcode": "B4Q5Q-CBmjB",
       "edge_media_to_comment": "[Object]",
       "taken_at_timestamp": 1572484953,
       "dimensions": "[Object]",
       "display_url":
        "https://instagram.fatz1-1.fna.fbcdn.net/vp/bd226ff8cf673943e32aa28696a9e66e/5E64A3DA/t51.2885-15/e35/73284628_148613809747256_665998994713792293_n.jpg?_nc_ht=instagram.fatz1-1.fna.fbcdn.net&_nc_cat=108",
       "edge_liked_by": "[Object]",
       "edge_media_preview_like": "[Object]",
       "owner": "[Object]",
       "thumbnail_src":
        "https://instagram.fatz1-1.fna.fbcdn.net/vp/3ff84475c7f81dc9c1e75d6524609b65/5E48B2A9/t51.2885-15/sh0.08/e35/s640x640/73284628_148613809747256_665998994713792293_n.jpg?_nc_ht=instagram.fatz1-1.fna.fbcdn.net&_nc_cat=108",
       "thumbnail_resources": "[Array]",
       "is_video": false,
       "accessibility_caption": "Image may contain: cat" } },
  ...
}

Run Locally:

  1. clone this repo
  2. cd ml-image-searcher/
  3. change LISTENER variable in .env file to: LISTENER='true'
  4. run node index.js
  5. open browser: localhost:8080

Response formats:

{
    originalData,      // result based on humans hashtags only
    filteredData,      // result based on humans hashtags and ML prediction
    htmlOriginalData,  // originalData images only in html format
    htmlFilteredData,  // filteredData images only in html format
    htmlAll,           // both results (htmlOriginalData + htmlFilteredData) in a table
};

ml-image-searcher's People

Contributors

dependabot[bot] avatar khaledalam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.