scp-api.js

1.1.0 • Public • Published

scp-api.js

CodeFactor NPM-Version NPM-Downloads Github Stars Issues

This a wrapper/scrapper of the SCP Fandom site.

There is no API key required.

To install use:

npm i scp-api.js

There is two ways to fetch data.

You can use the method API.fetchSCP without creating an API instance first as it creates an API instance and returns the data fetched. Or you can create and API instance and use getSCP to take adventage of local cache data.

Here you have the two examples:

const { API } = require('scp-api.js')

console.log('---- Direct Method: ----')
try {
    /* can also pass langs and other options */
    /* API.fetchSCP('3007', 'es', { return_api }) // This will return the API instance instead */
    console.log(await API.fetchSCP('3007')) 
} catch (e) {
    console.log(e)
}
console.log('---- Cache Method: ----')
const api = new API();
try {
    await api.getSCP('3007'); // 3007 data
    await api.getSCP('982'); // 982 data
    console.log(api.scps) // Array of all SCPs fetched yet
} catch (e) {
    console.log(e)
}

Disclaimer

This project is fully made for educational purposes

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    1

Package Sidebar

Install

npm i scp-api.js

Weekly Downloads

1

Version

1.1.0

License

GPL-3.0

Unpacked Size

42 kB

Total Files

8

Last publish

Collaborators

  • ifraan_