npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

scdl-api

v1.5.0

Published

Unofficially SoundCloud API

Downloads

5

Readme

SoundCloud API

📝Note

ID Jika Ada Bug, Silahkan Buat Issues

EN If there are bugs, please create Issues

📈 Highlights

  • [x] Private client id & oauth request
  • [x] Simple & easy to using
  • [x] 100% Safe
  • [x] No delay

⚙️Installation

⚙️ In Github

npm i github:RizzyFuzz/scdl-api

⚙️ In Npm

npm i scdl-api

🛠️ Require

 const scdl = require("scdl-api");

📄 Get Metadata

await scdl.soundcloud("https://soundcloud.com/prodbyscythe/crucible-w-antikvng").then(console.log);
{
  title: 'CRUCIBLE [W/ ANTIKVNG]',
  artist: 'sćythe',
  sharing: 'Public',
  genre: 'Unknown',
  likes: '189',
  comment: '75',
  reposts: '65',
  playback: '3.5K',
  duration: '00:02:30',
  createdAt: '2 February 2023, 04:23:09',
  description: '@antikvng\n\nbday upload!? 1/?!?!/',
  user: {
    artist: 'sćythe',
    username: 'prodbyscythe',
    track_count: '19',
    followers: '882',
    following: '247',
    permalink_url: 'https://soundcloud.com/prodbyscythe',
    avatar_url: 'https://i1.sndcdn.com/avatars-e4jEca43pMXqY0Gk-EVEPWQ-original.jpg'
  },
  media: {
    artwork_url: 'https://i1.sndcdn.com/artworks-GdEMyJyExIc7zEPs-WAKBCg-original.jpg',
    stream_url: 'https://tinyurl.com/2hsujao2'
  },
  status: 200,
  creator: 'RizzyFuzz'
}

🔎 Search Content

await scdl.sndsearch("CRUCIBLE [W/ ANTIKVNG]").then(console.log);
{
  result: [
    {
      title: 'CRUCIBLE [W/ ANTIKVNG]',
      url: 'https://m.soundcloud.com/prodbyscythe/crucible-w-antikvng',
      thumb: 'https://i1.sndcdn.com/artworks-GdEMyJyExIc7zEPs-WAKBCg-original.jpg',
      artist: 'sćythe',
      views: '3483',
      release: '1mo',
      timestamp: '2:30'
    },
    {
      title: 'wwyd. w/ blayence',
      url: 'https://m.soundcloud.com/antikvng/wwyd',
      thumb: 'https://i1.sndcdn.com/artworks-9BSkjWlePgIGTDRT-zZCxYw-original.jpg',
      artist: 'antikvng',
      views: '6914',
      release: '2w',
      timestamp: '2:19'
    },
    {
      title: 'GLUTEN. w/ legend',
      url: 'https://m.soundcloud.com/antikvng/gluten',
      thumb: 'https://i1.sndcdn.com/artworks-mwGJtFyU2MUKj9Er-mQFEvA-original.jpg',
      artist: 'antikvng',
      views: '7687',
      release: '2mo',
      timestamp: '1:56'
    },
    {
      title: 'every chance i get. (w/ bsterthegawd, legend)',
      url: 'https://m.soundcloud.com/antikvng/everychance',
      thumb: 'https://i1.sndcdn.com/artworks-99oB0MEUSQIWQZ1z-72dMAg-original.jpg',
      artist: 'antikvng',
      views: '47.5K',
      release: '1y',
      timestamp: '3:52'
    },
    {
      title: 'yungblood. (w/ kedalos)',
      url: 'https://m.soundcloud.com/antikvng/yungblood',
      thumb: 'https://i1.sndcdn.com/artworks-5OOl81OOnYnTWk6A-NVz3Yg-original.jpg',
      artist: 'antikvng',
      views: '15.7K',
      release: '8mo',
      timestamp: '1:36'
    },
    {
      title: 'mad man. (w/ legend)',
      url: 'https://m.soundcloud.com/antikvng/margiela',
      thumb: 'https://i1.sndcdn.com/artworks-ggkjDCzbnsqFQGJR-Nqyj0A-original.jpg',
      artist: 'antikvng',
      views: '37.8K',
      release: '1y',
      timestamp: '2:42'
    },
    {
      title: 'HELLMARY. (w/ KÉDALOS & SOMNII)',
      url: 'https://m.soundcloud.com/antikvng/hellmary',
      thumb: 'https://i1.sndcdn.com/artworks-RvNeWegzCfoeQryz-LRWsjA-original.jpg',
      artist: 'antikvng',
      views: '40.5K',
      release: '1y',
      timestamp: '5:00'
    },
    {
      title: 'a-man w/ blayence',
      url: 'https://m.soundcloud.com/antikvng/aman',
      thumb: 'https://i1.sndcdn.com/artworks-VfH8w9HI9FZnd9CR-6WBYyA-original.jpg',
      artist: 'antikvng',
      views: '14.6K',
      release: '4mo',
      timestamp: '2:36'
    },
    {
      title: "KILL 'EM ALL w/ antikvng",
      url: 'https://m.soundcloud.com/bsterthegawd/kill-em-all-w-antikvng',
      thumb: 'https://i1.sndcdn.com/artworks-EmBvSwzuJ9nVzvHz-htC8yg-original.jpg',
      artist: 'bsterthegawd',
      views: '25.7K',
      release: '4mo',
      timestamp: '2:48'
    },
    {
      title: 'final stage (w/ bster)',
      url: 'https://m.soundcloud.com/antikvng/final-stage-w-bster',
      thumb: 'https://i1.sndcdn.com/artworks-Lg7mL918dzoBwibe-y21FDQ-original.jpg',
      artist: 'antikvng',
      views: '36.7K',
      release: '2y',
      timestamp: '1:39'
    }
  ],
  status: 200,
  creator: 'RizzyFuzz'
}

💾 Downloading a Song With node-id3 Tags

const scdl = require("scdl-api");
const fs = require("fs");
const axios = require("axios");
const { spawn } = require("child_process");
const NodeID3 = require("node-id3");

async function downloadSong(url) {
  try {
    const song = await scdl.soundcloud(url);
    const streamUrl = `${song.media.stream_url}`;

    const response = await axios.get(streamUrl, { responseType: "arraybuffer" });
    const audioBuffer = Buffer.from(response.data);

    //Convert audio to 360kbps
    const ffmpeg = spawn("ffmpeg", [
      "-i", "pipe:0",
      "-f", "mp3",
      "-ab", "360k",
      "-"
    ]);

    const filename = `${song.title}.mp3`;

     ffmpeg.stdout.pipe(fs.createWriteStream(filename));

    ffmpeg.stdin.write(audioBuffer);
    ffmpeg.stdin.end();

    ffmpeg.on("close", async (code) => {
      if (code === 0) {
        const tags = {
          title: song.title,
          artist: song.artist,
          album: song.title,
          year: song.created_at,
          image: {
            mime: "image/jpeg",
            type: {
              id: 3,
              name: "front cover"
            },
            description: "SoundCloud album cover",
            imageBuffer: await axios.get(song.artwork_url, { responseType: "arraybuffer" })
              .then((res) => Buffer.from(res.data))
              .catch((err) => console.error("Error downloading album art:", err))
          }
        };

        const success = NodeID3.write(tags, filename);
        if (success) {
          console.log(`Finished writing song "${song.title}" to file "${filename}"!`);
        } else {
          console.error("Failed to write ID3 tags to file");
        }
      } else {
        console.error(`FFmpeg process exited with code ${code}`);
      }
    });
  } catch (err) {
    console.error(err);
  }
}

downloadSong("https://soundcloud.com/prodbyscythe/crucible-w-antikvng");