Socket
Socket
Sign inDemoInstall

supcommunity-api

Package Overview
Dependencies
25
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    supcommunity-api

Lightweight Supcommunity scraper in NodeJS


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
3.37 MB
Created
Weekly downloads
 

Readme

Source

supcommunity-api

version

npm

A lightweight module allowing you to scrape the Supcommunity website with NodeJS.


Installation


npm install supcommunity-api

Or with yarn,


yarn add supcommunity-api


Notes

supcommunity-api is an es6 based library, so if you use the es5 require to import the module, you will need to use .default.


const  SupcommunityScraper = require('supcommunity-api').default;

//Continue usage as normal

supcommunity-api is a promise based library, which means you can use .catch, .then, and await


Updates

1.0.2

Supcommunity has updated their formatting of items. This update adapts to the new structure of their website.

  • API usage unchanged, but description has been removed

Usage

The SupcommunityScraper constructor takes in 1 option - a proxy. Please format this using the normal proxy format ip:port:user:password.


import  SupcommunityScraper  from  'supcommunity-api';

  

const  SupcommunityController = new  SupcommunityScraper({

proxy:  'your-proxy-here'

});

Fetch latest week

The fetchLatestWeek method will return the latest droplist URL.

For example:


import  SupcommunityScraper  from  'supcommunity-api';

  

const  SupcommunityController = new  SupcommunityScraper();

  

SupcommunityController.fetchLatestWeek()
.then(href  =>  console.log(href)) -> "https://www.supremecommunity.com/season/spring-summer2021/droplists/"
.catch(err  =>  console.error(err.message));

Fetch droplist items

The fetchDroplistItems method will return all the items from a drop URL in an array.

This takes in the href parameter, the droplist URL to retrieve from.

For example:


import  SupcommunityScraper  from  'supcommunity-api';

  

const  SupcommunityController = new  SupcommunityScraper();

  

(async () => {

const  latestWeek = await  SupcommunityController.fetchLatestWeek();

const  droplistItems = await  SupcommunityController.fetchDroplistItems(latestWeek);

  

console.log(droplistItems);

})();

Data returned ()

[
  {
    name: String,
    image: String,
    category: String,
    price: String,
    positiveVotes: Number,
    negativeVotes: Number,
    votePercentage: Number
  }
]

FAQs

Last updated on 11 May 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc