New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nocopyrightsounds-api

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nocopyrightsounds-api

A webscraper for the NoCopyrightSounds website to provide an API

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NoCopyrightSounds API

This is a webscraper designed to provide api like access to the NCS website

Features

  • Listing all Songs

  • Searching (using the search from the website)

  • getting artist info

  • caching songs (client class only)

import

//module (reccomended)
import * as ncs from 'nocopyrightsounds-api'

//CommonJS
const ncs = require('nocopyrightsounds-api')

examples

direct API Access

get all songs from the first page in the music library

import * as ncs from 'nocopyrightsounds-api'

ncs
  .getMusic(/*page here*/)
  .then(songs => {
    //use the songs here
    console.log(songs)
  })
  .catch(err => {
    //error handeling here
    console.error(err)
  })

get all songs from the first page of house songs

import * as ncs from 'nocopyrightsounds-api'

ncs
  .search(
    {
      genre: 10
    } /*page here*/
  )
  .then(songs => {
    //use the songs here
    console.log(songs)
  })
  .catch(err => {
    //error handeling here
    console.error(err)
  })

get artist info

import * as ncs from 'nocopyrightsounds-api'
ncs
  .getArtistInfo(/* artist url here (/artist/760/srikar)*/)
  .then(artist => {
    //use the artist info here
    console.log(artist)
  })
  .catch(err => {
    //error handeling here
    console.error(err)
  })

download the newest song

import * as ncs from 'nocopyrightsounds-api'
import * as fs from 'fs'
import https from 'https'

ncs
  .getMusic()
  .then(async songs => {
    const newest = songs[0]
    const directUrl = newest.songUrl

    const writeStream = fs.createWriteStream(`${newest.name}.mp3`)

    https.get(directUrl, res => {
      res.pipe(writeStream)
    })
  })
  .catch(err => {
    //just simple error handeling
    console.error(err)
  })

in the browser

import * as ncs from 'nocopyrightsounds-api'

ncs.web // add ".web" before the function
  .getMusic(/*page here*/)
  .then(songs => {
    //use the songs here
    console.log(songs)
  })
  .catch(err => {
    //error handeling here
    console.error(err)
  })

using the client class

in nodejs

import * as ncs from 'nocopyrightsounds-api'

const client = new ncs.Client()

client
  .getSongs()
  .then(songs => {
    //use the songs here
    console.log(songs)
  })
  .catch(err => {
    //error handeling here
    console.error(err)
  })

in the browser

import * as ncs from 'nocopyrightsounds-api'

const client = new ncs.Client({
  web: true,
  proxy_url: /*add your proxy url here (use the NoCopyrightSounds-API-server found on npm)*/
})

with caching

import * as ncs from 'nocopyrightsounds-api'

const client = new ncs.Client({
  use_cache: true,
  cache_path: /*path for json file in nodejs or name for localstorage in browser*/
})
refreshing the cache
client.getCache().checkForNew()

for debuging

import * as ncs from 'nocopyrightsounds-api'

const client = new ncs.Client({
  detailed_log: true
})

FAQs

Package last updated on 18 Apr 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc