3.0.0 • Published 6 years ago

ig-scrap-cache v3.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

ig-scrap-cache


search media using tag name, and cache that using redis

initial

var IgScrapCache = require('ig-scrap-cache')

var igScrap = new IgScrapCache({
  redis: {  
    //redis options
    port: 6379,
    host: '127.0.0.1'
  },
  config: {
    //optional, defaults
    force: false,
    cacheTime: 60*30,//30mins
    enableFirstTime: false
  }
})

CONFIGS

redis

config

configrequiredetcdefault
forcefalseforce update, ignore cachefalse
cacheTimefalsecached time30*60
aheadTimefalseenable caching time ahead of cached time5*60
enableFirstTimefalseenable a loading at first timefalse

useage

search media by tags

//https://www.instagram.com/explore/tags/{{tab}}/ or tag
igScrap.getMediaByTag(tag_name/*or url*/, function (err, result) {
//result
})

search media by users

// https://www.instagram.com/{{userid}}/ or userid
igScrap.getMediaByUser(user/*or url*/, function (err, result) {
//result
})

search users

// https://www.instagram.com/{{userid}}/ or userid
igScrap.getUser(user/*or url*/, function (err, result) {
  var user = result.user
  var media = result.media
})

search media by users

it is unstable

// https://www.instagram.com/{{userid}}/ or https://www.instagram.com/explore/tags/{{tab}}
igScrap.getMedia(url, function (err, result) {
// result.thumbnails()
// result.standard()
//result
})

clear cache

//remove cache about cache time, cache result, not queue
igScrap.getMedia(url, function (err, result) {
  // result.thumbnails()
  // result.standard()
  //result
})

warning

In case of first time in search by tag, return empty array, use enableFirstTime option

#change log

1.1.0

  • tag_name, user can be repleaced as url
  • add method 'getMedia'

2.0.0

  • use namespace (IGSCRAPE)
  • add getUser, clearCache
  • crawling code is modularized

3.0.0

  • version up ig-scrap module

#test

  • npm test
3.0.0

6 years ago

2.0.0

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago