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 - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

.prettierrc

6

dist/cjs/classes/artist.d.ts
export default interface Artist {
name: string;
url: string;
name: string
url: string
}
export default class Artist {
constructor(name: string, url: string);
constructor(name: string, url: string)
}

@@ -1,10 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
var Artist = /** @class */ (function () {
function Artist(name, url) {
this.name = name;
this.url = url;
}
return Artist;
}());
exports.default = Artist;
function Artist(name, url) {
this.name = name
this.url = url
}
return Artist
})()
exports.default = Artist

@@ -1,13 +0,21 @@

import type Artist from './artist';
import type Artist from './artist'
export default interface Song {
name: string;
date: string;
genre: string;
artists: Artist[];
url: string;
imageUrl: string;
songUrl: string;
name: string
date: string
genre: string
artists: Artist[]
url: string
imageUrl: string
songUrl: string
}
export default class Song {
constructor(name: string, date: string, genre: string, artists: Artist[], url: string, imageUrl: string, songUrl: string);
constructor(
name: string,
date: string,
genre: string,
artists: Artist[],
url: string,
imageUrl: string,
songUrl: string
)
}

@@ -1,15 +0,15 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
var Song = /** @class */ (function () {
function Song(name, date, genre, artists, url, imageUrl, songUrl) {
this.name = name;
this.date = date;
this.genre = genre;
this.artists = artists;
this.url = url;
this.imageUrl = imageUrl;
this.songUrl = songUrl;
}
return Song;
}());
exports.default = Song;
function Song(name, date, genre, artists, url, imageUrl, songUrl) {
this.name = name
this.date = date
this.genre = genre
this.artists = artists
this.url = url
this.imageUrl = imageUrl
this.songUrl = songUrl
}
return Song
})()
exports.default = Song

@@ -1,2 +0,2 @@

import Song from './classes/song';
export declare const getSongs: (page: number) => Promise<Song[]>;
import Song from './classes/song'
export declare const getSongs: (page: number) => Promise<Song[]>

@@ -1,45 +0,63 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSongs = void 0;
var node_fetch_1 = require("node-fetch");
var node_html_parser_1 = require("node-html-parser");
var artist_1 = require("./classes/artist");
var song_1 = require("./classes/song");
'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
exports.getSongs = void 0
var node_fetch_1 = require('node-fetch')
var node_html_parser_1 = require('node-html-parser')
var artist_1 = require('./classes/artist')
var song_1 = require('./classes/song')
var getSongs = function (page) {
return new Promise(function (resolve, reject) {
node_fetch_1.default("https://ncs.io/music?page=" + (page ? page : 1)).then(function (res) {
return res.text();
}).then(function (html) {
var root = node_html_parser_1.parse(html);
var songsHtml = root.querySelectorAll('div.col-lg-2.item');
var songs = songsHtml.map(function (song) {
var _a;
var link = song.querySelector('a[href]').getAttribute('href');
var imageUrl = (_a = song.querySelector('div.img[style]').getAttribute('style')) === null || _a === void 0 ? void 0 : _a.split('\'')[1];
var name = song.querySelector('.bottom p strong').innerHTML;
var optionsEl = song.querySelector('div.options');
var date = optionsEl.querySelector('p[title]').getAttribute('title');
var genre = optionsEl.querySelector('strong').innerHTML;
var songLinkEl = optionsEl.querySelector('a.btn.black.player-play');
var songUrl = songLinkEl.getAttribute('data-url');
var artistsEl = songLinkEl.getAttribute('data-artist');
if (!artistsEl || !name || !date || !link || !imageUrl || !songUrl)
return new song_1.default('', '', '', [], '', '', '');
var artists = artistsEl === null || artistsEl === void 0 ? void 0 : artistsEl.split(', ').map(function (art) {
var artEl = node_html_parser_1.parse(art);
var url = artEl.getAttribute('href');
var name = artEl.innerHTML;
if (!url)
return new artist_1.default(name, '');
else
return new artist_1.default(name, url);
});
return new song_1.default(name, date, genre, artists, link, imageUrl, songUrl);
});
resolve(songs);
}).catch(function (err) {
reject(err);
});
});
};
exports.getSongs = getSongs;
return new Promise(function (resolve, reject) {
node_fetch_1
.default('https://ncs.io/music?page=' + (page ? page : 1))
.then(function (res) {
return res.text()
})
.then(function (html) {
var root = node_html_parser_1.parse(html)
var songsHtml = root.querySelectorAll('div.col-lg-2.item')
var songs = songsHtml.map(function (song) {
var _a
var link = song.querySelector('a[href]').getAttribute('href')
var imageUrl =
(_a = song
.querySelector('div.img[style]')
.getAttribute('style')) === null || _a === void 0
? void 0
: _a.split("'")[1]
var name = song.querySelector('.bottom p strong').innerHTML
var optionsEl = song.querySelector('div.options')
var date = optionsEl.querySelector('p[title]').getAttribute('title')
var genre = optionsEl.querySelector('strong').innerHTML
var songLinkEl = optionsEl.querySelector('a.btn.black.player-play')
var songUrl = songLinkEl.getAttribute('data-url')
var artistsEl = songLinkEl.getAttribute('data-artist')
if (!artistsEl || !name || !date || !link || !imageUrl || !songUrl)
return new song_1.default('', '', '', [], '', '', '')
var artists =
artistsEl === null || artistsEl === void 0
? void 0
: artistsEl.split(', ').map(function (art) {
var artEl = node_html_parser_1.parse(art)
var url = artEl.getAttribute('href')
var name = artEl.innerHTML
if (!url) return new artist_1.default(name, '')
else return new artist_1.default(name, url)
})
return new song_1.default(
name,
date,
genre,
artists,
link,
imageUrl,
songUrl
)
})
resolve(songs)
})
.catch(function (err) {
reject(err)
})
})
}
exports.getSongs = getSongs
export default interface Artist {
name: string;
url: string;
name: string
url: string
}
export default class Artist {
constructor(name: string, url: string);
constructor(name: string, url: string)
}
var Artist = /** @class */ (function () {
function Artist(name, url) {
this.name = name;
this.url = url;
}
return Artist;
}());
export default Artist;
function Artist(name, url) {
this.name = name
this.url = url
}
return Artist
})()
export default Artist

@@ -1,13 +0,21 @@

import type Artist from './artist';
import type Artist from './artist'
export default interface Song {
name: string;
date: string;
genre: string;
artists: Artist[];
url: string;
imageUrl: string;
songUrl: string;
name: string
date: string
genre: string
artists: Artist[]
url: string
imageUrl: string
songUrl: string
}
export default class Song {
constructor(name: string, date: string, genre: string, artists: Artist[], url: string, imageUrl: string, songUrl: string);
constructor(
name: string,
date: string,
genre: string,
artists: Artist[],
url: string,
imageUrl: string,
songUrl: string
)
}
var Song = /** @class */ (function () {
function Song(name, date, genre, artists, url, imageUrl, songUrl) {
this.name = name;
this.date = date;
this.genre = genre;
this.artists = artists;
this.url = url;
this.imageUrl = imageUrl;
this.songUrl = songUrl;
}
return Song;
}());
export default Song;
function Song(name, date, genre, artists, url, imageUrl, songUrl) {
this.name = name
this.date = date
this.genre = genre
this.artists = artists
this.url = url
this.imageUrl = imageUrl
this.songUrl = songUrl
}
return Song
})()
export default Song

@@ -1,2 +0,2 @@

import Song from './classes/song';
export declare const getSongs: (page: number) => Promise<Song[]>;
import Song from './classes/song'
export declare const getSongs: (page: number) => Promise<Song[]>

@@ -1,41 +0,50 @@

import fetch from 'node-fetch';
import { parse as parseHTML } from 'node-html-parser';
import Artist from './classes/artist';
import Song from './classes/song';
import fetch from 'node-fetch'
import { parse as parseHTML } from 'node-html-parser'
import Artist from './classes/artist'
import Song from './classes/song'
export var getSongs = function (page) {
return new Promise(function (resolve, reject) {
fetch("https://ncs.io/music?page=" + (page ? page : 1)).then(function (res) {
return res.text();
}).then(function (html) {
var root = parseHTML(html);
var songsHtml = root.querySelectorAll('div.col-lg-2.item');
var songs = songsHtml.map(function (song) {
var _a;
var link = song.querySelector('a[href]').getAttribute('href');
var imageUrl = (_a = song.querySelector('div.img[style]').getAttribute('style')) === null || _a === void 0 ? void 0 : _a.split('\'')[1];
var name = song.querySelector('.bottom p strong').innerHTML;
var optionsEl = song.querySelector('div.options');
var date = optionsEl.querySelector('p[title]').getAttribute('title');
var genre = optionsEl.querySelector('strong').innerHTML;
var songLinkEl = optionsEl.querySelector('a.btn.black.player-play');
var songUrl = songLinkEl.getAttribute('data-url');
var artistsEl = songLinkEl.getAttribute('data-artist');
if (!artistsEl || !name || !date || !link || !imageUrl || !songUrl)
return new Song('', '', '', [], '', '', '');
var artists = artistsEl === null || artistsEl === void 0 ? void 0 : artistsEl.split(', ').map(function (art) {
var artEl = parseHTML(art);
var url = artEl.getAttribute('href');
var name = artEl.innerHTML;
if (!url)
return new Artist(name, '');
else
return new Artist(name, url);
});
return new Song(name, date, genre, artists, link, imageUrl, songUrl);
});
resolve(songs);
}).catch(function (err) {
reject(err);
});
});
};
return new Promise(function (resolve, reject) {
fetch('https://ncs.io/music?page=' + (page ? page : 1))
.then(function (res) {
return res.text()
})
.then(function (html) {
var root = parseHTML(html)
var songsHtml = root.querySelectorAll('div.col-lg-2.item')
var songs = songsHtml.map(function (song) {
var _a
var link = song.querySelector('a[href]').getAttribute('href')
var imageUrl =
(_a = song
.querySelector('div.img[style]')
.getAttribute('style')) === null || _a === void 0
? void 0
: _a.split("'")[1]
var name = song.querySelector('.bottom p strong').innerHTML
var optionsEl = song.querySelector('div.options')
var date = optionsEl.querySelector('p[title]').getAttribute('title')
var genre = optionsEl.querySelector('strong').innerHTML
var songLinkEl = optionsEl.querySelector('a.btn.black.player-play')
var songUrl = songLinkEl.getAttribute('data-url')
var artistsEl = songLinkEl.getAttribute('data-artist')
if (!artistsEl || !name || !date || !link || !imageUrl || !songUrl)
return new Song('', '', '', [], '', '', '')
var artists =
artistsEl === null || artistsEl === void 0
? void 0
: artistsEl.split(', ').map(function (art) {
var artEl = parseHTML(art)
var url = artEl.getAttribute('href')
var name = artEl.innerHTML
if (!url) return new Artist(name, '')
else return new Artist(name, url)
})
return new Song(name, date, genre, artists, link, imageUrl, songUrl)
})
resolve(songs)
})
.catch(function (err) {
reject(err)
})
})
}
{
"name": "nocopyrightsounds-api",
"version": "1.0.1",
"version": "1.0.2",
"description": "A webscraper for the NoCopyrightSounds website to provide an API",
"main": "dist/cjs/main.js",
"module": "dist/esm/main.js",
"repository": {
"type": "git",
"url": "https://github.com/KaninchenSpeed/NoCopyrightSounds-API"
},
"scripts": {

@@ -11,3 +15,4 @@ "build": "tsc --module CommonJS --outDir dist/cjs && tsc --module ES2020 --outDir dist/esm",

"dev": "concurrently \"npm run buildWatch\" \"npm run devStart\"",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build && npm run prettier && npm version patch",
"prettier": "prettier --write ."
},

@@ -20,2 +25,3 @@ "keywords": [],

"concurrently": "^6.2.0",
"prettier": "^2.3.2",
"typescript": "^4.3.5"

@@ -22,0 +28,0 @@ },

# NoCopyrightSounds API
This is a webscraper designed to provide an api like access to the NCS website
export default interface Artist {
name: string
url: string
name: string
url: string
}
export default class Artist {
constructor(name: string, url: string) {
this.name = name
this.url = url
}
}
constructor(name: string, url: string) {
this.name = name
this.url = url
}
}
import type Artist from './artist'
export default interface Song {
name: string
date: string
genre: string
artists: Artist[]
url: string
imageUrl: string
name: string
date: string
genre: string
artists: Artist[]
url: string
imageUrl: string
songUrl: string
}
export default class Song {
constructor(
name: string,
date: string,
genre: string,
artists: Artist[],
url: string,
imageUrl: string,
songUrl: string
) {
this.name = name
this.date = date
this.genre = genre
this.artists = artists
this.url = url
this.imageUrl = imageUrl
this.songUrl = songUrl
}
}
export default class Song {
constructor(name: string, date: string, genre: string, artists: Artist[], url: string, imageUrl: string, songUrl: string) {
this.name = name
this.date = date
this.genre = genre
this.artists = artists
this.url = url
this.imageUrl = imageUrl
this.songUrl = songUrl
}
}

@@ -8,44 +8,44 @@ import fetch from 'node-fetch'

export const getSongs = (page: number): Promise<Song[]> => {
return new Promise<Song[]>((resolve, reject) => {
fetch(`https://ncs.io/music?page=${page ? page : 1}`)
.then((res) => {
return res.text()
})
.then((html) => {
const root = parseHTML(html)
const songsHtml = root.querySelectorAll('div.col-lg-2.item')
const songs: Song[] = songsHtml.map((song: HTMLElement) => {
const link = song.querySelector('a[href]').getAttribute('href')
const imageUrl = song
.querySelector('div.img[style]')
.getAttribute('style')
?.split("'")[1]
const name = song.querySelector('.bottom p strong').innerHTML
const optionsEl = song.querySelector('div.options')
const date = optionsEl.querySelector('p[title]').getAttribute('title')
const genre = optionsEl.querySelector('strong').innerHTML
const songLinkEl = optionsEl.querySelector('a.btn.black.player-play')
const songUrl = songLinkEl.getAttribute('data-url')
const artistsEl = songLinkEl.getAttribute('data-artist')
export const getSongs = (page: number): Promise<Song[]> => {
return new Promise<Song[]>((resolve, reject) => {
fetch(`https://ncs.io/music?page=${page ? page : 1}`).then(res => {
return res.text()
}).then(html => {
const root = parseHTML(html)
const songsHtml = root.querySelectorAll('div.col-lg-2.item')
const songs: Song[] = songsHtml.map((song: HTMLElement) => {
const link = song.querySelector('a[href]').getAttribute('href')
const imageUrl = song.querySelector('div.img[style]').getAttribute('style')?.split('\'')[1]
const name = song.querySelector('.bottom p strong').innerHTML
const optionsEl = song.querySelector('div.options')
const date = optionsEl.querySelector('p[title]').getAttribute('title')
const genre = optionsEl.querySelector('strong').innerHTML
const songLinkEl = optionsEl.querySelector('a.btn.black.player-play')
const songUrl = songLinkEl.getAttribute('data-url')
const artistsEl = songLinkEl.getAttribute('data-artist')
if (!artistsEl || !name || !date || !link || !imageUrl || !songUrl) return new Song('', '', '', [], '', '', '')
const artists: Artist[] = artistsEl?.split(', ').map((art: string) => {
const artEl = parseHTML(art)
const url = artEl.getAttribute('href')
const name = artEl.innerHTML
if (!url) return new Artist(name, '')
else return new Artist(name, url)
})
return new Song(
name,
date,
genre,
artists,
link,
imageUrl,
songUrl
)
if (!artistsEl || !name || !date || !link || !imageUrl || !songUrl)
return new Song('', '', '', [], '', '', '')
const artists: Artist[] = artistsEl
?.split(', ')
.map((art: string) => {
const artEl = parseHTML(art)
const url = artEl.getAttribute('href')
const name = artEl.innerHTML
if (!url) return new Artist(name, '')
else return new Artist(name, url)
})
resolve(songs)
}).catch(err => {
reject(err)
return new Song(name, date, genre, artists, link, imageUrl, songUrl)
})
})
}
resolve(songs)
})
.catch((err) => {
reject(err)
})
})
}

@@ -8,5 +8,3 @@ {

},
"include": [
"./src"
]
}
"include": ["./src"]
}
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