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

  • 3.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
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

Updating from 2.1.3

Breaking changes

  • Removed Client class
  • Page indices start from 0 insted of 1
  • Rename: getMusic(page) => getSongs(page)
  • Song object
    • songUrl => previewUrl
    • imageUrl => coverUrl
    • Date is now a Date object

New stuff

  • Enums for Genre and Mood
  • Filter for instrumental songs
  • Song object
    • download section with regular and/or instrumental downloads

Import

//module (recommended)
import ncs from 'nocopyrightsounds-api'

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

Typescript

Don't forget to set esModuleInterop to true

Examples

Top level await is only available with es modules in NodeJS.

Get all songs from the first page in the music library

import ncs from 'nocopyrightsounds-api'

const songs = await ncs.getSongs(/* page here */)

// use the songs here
console.log(songs)

Get all songs from the first page of house songs

import ncs from 'nocopyrightsounds-api'

const results = await ncs.search(
    {
        // filter
        genre: ncs.Genre.House
    }
    /* page here */
)

// use the results here
console.log(results)

Get artist info

import ncs from 'nocopyrightsounds-api'

const artistInfo = await ncs.getArtistInfo(/* artist url here (/artist/760/srikar) */)

// use the artistinfo info here
console.log(artistInfo)

Download the newest song

import ncs from 'nocopyrightsounds-api'
import axios from 'axios'
import fs from 'fs/promises'

// getting the newest 20 songs (20 songs = 1 page)
const songs = await ncs.getSongs()

const newestSong = songs[0]
const audioUrl = newestSong.download.regular

if (!audioUrl) throw "This Song doesn't have a regular (non instrumental) version!"

// downloading audio
const { data: audioFile } = await axios.get(audioUrl, {
    responseType: 'arraybuffer'
})

await fs.writeFile(`${newestSong.name}.mp3`, audioFile)

Keywords

FAQs

Package last updated on 15 Mar 2024

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