zackradisic / node-soundcloud-downloader Goto Github PK
View Code? Open in Web Editor NEWA SoundCloud API v2 wrapper for Node.js
License: MIT License
A SoundCloud API v2 wrapper for Node.js
License: MIT License
Hi all - I'm getting a http 400/Bad Request error when using getSetInfo() for some playlists (e.g. https://soundcloud.com/ilyanaazman/sets/best-of-mrrevillz or https://soundcloud.com/ilyanaazman/sets/bestofchillnation) while most others are perfectly fine (e.g. https://soundcloud.com/ilyanaazman/sets/latenightlofi).
Console output below with masked out client_id:
Error: Request failed with status code 400 at createError (/workspace/node_modules/axios/lib/core/createError.js:16:15) at settle (/workspace/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/workspace/node_modules/axios/lib/adapters/http.js:244:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1220:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) {
config: {
url: 'https://api-v2.soundcloud.com/tracks?ids=867665638%2C916488845%2C916541744%2C879502579%2C911544727%2C920224540%2C920227672%2C912258409%2C182859485%2C879588352%2C871408492%2C903271243%2C899338447%2C907746022%2C906903244%2C851514058%2C907746013%2C899541523%2C871778755%2C845983675%2C727730749%2C310455689%2C351996389%2C221308049%2C617744415%2C222335592%2C220021334%2C625572180%2C586430472%2C136515969%2C350544130%2C292528042%2C672835793%2C233271745%2C634818096%2C345014116%2C194674830%2C613079007%2C219240973%2C250830766%2C157946069%2C242071122%2C220940419%2C356904608%2C447921720%2C325876880%2C303520330%2C577977645%2C258583921%2C329292478%2C302734389%2C288394390%2C304744944%2C213828110%2C158384606%2C322256287%2C654816296%2C321085206%2C180526491%2C151836932%2C240510101%2C259932466%2C340422811%2C120417156%2C308158931%2C242970980%2C265004302%2C225515495%2C94470145%2C147235179%2C193641840%2C192956375%2C243086787%2C418406040%2C319849669%2C361549280%2C348894700%2C357040427%2C482437833%2C252638815%2C465024060%2C465229422%2C450607776%2C329511908%2C493285392%2C489363333%2C502948368%2C509000139%2C411189549%2C290210997%2C519271257%2C519206883%2C604903338%2C578505426%2C560864886%2C556088364%2C546188349%2C516324954%2C145367831%2C323733248%2C135322127%2C353880398%2C396944928%2C296968053%2C494976372%2C215558123%2C190445096%2C192408098%2C242672575%2C204778816%2C319887152%2C403960782%2C194510401%2C214816945%2C383884892%2C341315415%2C172595409%2C210014181%2C519749160%2C226139958%2C483679920%2C84118776%2C473381727%2C214140973%2C489177243%2C266963313%2C285262888%2C272020529&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
method: 'get',
headers: {
Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/0.20.0'
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
data: undefined
},
request: ClientRequest {
_events: [Object: null prototype] {
socket: [Function],
abort: [Function],
aborted: [Function],
connect: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: 'api-v2.soundcloud.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api-v2.soundcloud.com',
_readableState: [ReadableState],
readable: true,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 210925,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
connection: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: 'api-v2.soundcloud.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api-v2.soundcloud.com',
_readableState: [ReadableState],
readable: true,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 210925,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
_header: 'GET /tracks?ids=867665638%2C916488845%2C916541744%2C879502579%2C911544727%2C920224540%2C920227672%2C912258409%2C182859485%2C879588352%2C871408492%2C903271243%2C899338447%2C907746022%2C906903244%2C851514058%2C907746013%2C899541523%2C871778755%2C845983675%2C727730749%2C310455689%2C351996389%2C221308049%2C617744415%2C222335592%2C220021334%2C625572180%2C586430472%2C136515969%2C350544130%2C292528042%2C672835793%2C233271745%2C634818096%2C345014116%2C194674830%2C613079007%2C219240973%2C250830766%2C157946069%2C242071122%2C220940419%2C356904608%2C447921720%2C325876880%2C303520330%2C577977645%2C258583921%2C329292478%2C302734389%2C288394390%2C304744944%2C213828110%2C158384606%2C322256287%2C654816296%2C321085206%2C180526491%2C151836932%2C240510101%2C259932466%2C340422811%2C120417156%2C308158931%2C242970980%2C265004302%2C225515495%2C94470145%2C147235179%2C193641840%2C192956375%2C243086787%2C418406040%2C319849669%2C361549280%2C348894700%2C357040427%2C482437833%2C252638815%2C465024060%2C465229422%2C450607776%2C329511908%2C493285392%2C489363333%2C502948368%2C509000139%2C411189549%2C290210997%2C519271257%2C519206883%2C604903338%2C578505426%2C560864886%2C556088364%2C546188349%2C516324954%2C145367831%2C323733248%2C135322127%2C353880398%2C396944928%2C296968053%2C494976372%2C215558123%2C190445096%2C192408098%2C242672575%2C204778816%2C319887152%2C403960782%2C194510401%2C214816945%2C383884892%2C341315415%2C172595409%2C210014181%2C519749160%2C226139958%2C483679920%2C84118776%2C473381727%2C214140973%2C489177243%2C266963313%2C285262888%2C272020529&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'User-Agent: axios/0.20.0\r\n' +
'Host: api-v2.soundcloud.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path: '/tracks?ids=867665638%2C916488845%2C916541744%2C879502579%2C911544727%2C920224540%2C920227672%2C912258409%2C182859485%2C879588352%2C871408492%2C903271243%2C899338447%2C907746022%2C906903244%2C851514058%2C907746013%2C899541523%2C871778755%2C845983675%2C727730749%2C310455689%2C351996389%2C221308049%2C617744415%2C222335592%2C220021334%2C625572180%2C586430472%2C136515969%2C350544130%2C292528042%2C672835793%2C233271745%2C634818096%2C345014116%2C194674830%2C613079007%2C219240973%2C250830766%2C157946069%2C242071122%2C220940419%2C356904608%2C447921720%2C325876880%2C303520330%2C577977645%2C258583921%2C329292478%2C302734389%2C288394390%2C304744944%2C213828110%2C158384606%2C322256287%2C654816296%2C321085206%2C180526491%2C151836932%2C240510101%2C259932466%2C340422811%2C120417156%2C308158931%2C242970980%2C265004302%2C225515495%2C94470145%2C147235179%2C193641840%2C192956375%2C243086787%2C418406040%2C319849669%2C361549280%2C348894700%2C357040427%2C482437833%2C252638815%2C465024060%2C465229422%2C450607776%2C329511908%2C493285392%2C489363333%2C502948368%2C509000139%2C411189549%2C290210997%2C519271257%2C519206883%2C604903338%2C578505426%2C560864886%2C556088364%2C546188349%2C516324954%2C145367831%2C323733248%2C135322127%2C353880398%2C396944928%2C296968053%2C494976372%2C215558123%2C190445096%2C192408098%2C242672575%2C204778816%2C319887152%2C403960782%2C194510401%2C214816945%2C383884892%2C341315415%2C172595409%2C210014181%2C519749160%2C226139958%2C483679920%2C84118776%2C473381727%2C214140973%2C489177243%2C266963313%2C285262888%2C272020529&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
readable: false,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
socket: [TLSSocket],
connection: [TLSSocket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 400,
statusMessage: 'Bad Request',
client: [TLSSocket],
_consuming: false,
_dumped: false,
req: [Circular],
responseUrl: 'https://api-v2.soundcloud.com/tracks?ids=867665638%2C916488845%2C916541744%2C879502579%2C911544727%2C920224540%2C920227672%2C912258409%2C182859485%2C879588352%2C871408492%2C903271243%2C899338447%2C907746022%2C906903244%2C851514058%2C907746013%2C899541523%2C871778755%2C845983675%2C727730749%2C310455689%2C351996389%2C221308049%2C617744415%2C222335592%2C220021334%2C625572180%2C586430472%2C136515969%2C350544130%2C292528042%2C672835793%2C233271745%2C634818096%2C345014116%2C194674830%2C613079007%2C219240973%2C250830766%2C157946069%2C242071122%2C220940419%2C356904608%2C447921720%2C325876880%2C303520330%2C577977645%2C258583921%2C329292478%2C302734389%2C288394390%2C304744944%2C213828110%2C158384606%2C322256287%2C654816296%2C321085206%2C180526491%2C151836932%2C240510101%2C259932466%2C340422811%2C120417156%2C308158931%2C242970980%2C265004302%2C225515495%2C94470145%2C147235179%2C193641840%2C192956375%2C243086787%2C418406040%2C319849669%2C361549280%2C348894700%2C357040427%2C482437833%2C252638815%2C465024060%2C465229422%2C450607776%2C329511908%2C493285392%2C489363333%2C502948368%2C509000139%2C411189549%2C290210997%2C519271257%2C519206883%2C604903338%2C578505426%2C560864886%2C556088364%2C546188349%2C516324954%2C145367831%2C323733248%2C135322127%2C353880398%2C396944928%2C296968053%2C494976372%2C215558123%2C190445096%2C192408098%2C242672575%2C204778816%2C319887152%2C403960782%2C194510401%2C214816945%2C383884892%2C341315415%2C172595409%2C210014181%2C519749160%2C226139958%2C483679920%2C84118776%2C473381727%2C214140973%2C489177243%2C266963313%2C285262888%2C272020529&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
redirects: [],
[Symbol(kCapture)]: false
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
_redirectable: Writable {
_writableState: [WritableState],
writable: true,
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://api-v2.soundcloud.com/tracks?ids=867665638%2C916488845%2C916541744%2C879502579%2C911544727%2C920224540%2C920227672%2C912258409%2C182859485%2C879588352%2C871408492%2C903271243%2C899338447%2C907746022%2C906903244%2C851514058%2C907746013%2C899541523%2C871778755%2C845983675%2C727730749%2C310455689%2C351996389%2C221308049%2C617744415%2C222335592%2C220021334%2C625572180%2C586430472%2C136515969%2C350544130%2C292528042%2C672835793%2C233271745%2C634818096%2C345014116%2C194674830%2C613079007%2C219240973%2C250830766%2C157946069%2C242071122%2C220940419%2C356904608%2C447921720%2C325876880%2C303520330%2C577977645%2C258583921%2C329292478%2C302734389%2C288394390%2C304744944%2C213828110%2C158384606%2C322256287%2C654816296%2C321085206%2C180526491%2C151836932%2C240510101%2C259932466%2C340422811%2C120417156%2C308158931%2C242970980%2C265004302%2C225515495%2C94470145%2C147235179%2C193641840%2C192956375%2C243086787%2C418406040%2C319849669%2C361549280%2C348894700%2C357040427%2C482437833%2C252638815%2C465024060%2C465229422%2C450607776%2C329511908%2C493285392%2C489363333%2C502948368%2C509000139%2C411189549%2C290210997%2C519271257%2C519206883%2C604903338%2C578505426%2C560864886%2C556088364%2C546188349%2C516324954%2C145367831%2C323733248%2C135322127%2C353880398%2C396944928%2C296968053%2C494976372%2C215558123%2C190445096%2C192408098%2C242672575%2C204778816%2C319887152%2C403960782%2C194510401%2C214816945%2C383884892%2C341315415%2C172595409%2C210014181%2C519749160%2C226139958%2C483679920%2C84118776%2C473381727%2C214140973%2C489177243%2C266963313%2C285262888%2C272020529&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'user-agent': [Array],
host: [Array]
}
},
response: {
status: 400,
statusText: 'Bad Request',
headers: {
'strict-transport-security': 'max-age=63072000',
vary: 'Origin',
via: '1.1 e57fe70b9ed429fb51b4b2432cadc67b.cloudfront.net (CloudFront)',
'x-amz-cf-id': 'YbS6yqSmjIrGDdLZqKdTd3QHiqETWVPsKNUV43eE_Zak-hrQqsoAAQ=='
config: {
url: 'https://api-v2.soundcloud.com/tracks?ids=867665638%2C916488845%2C916541744%2C879502579%2C911544727%2C920224540%2C920227672%2C912258409%2C182859485%2C879588352%2C871408492%2C903271243%2C899338447%2C907746022%2C906903244%2C851514058%2C907746013%2C899541523%2C871778755%2C845983675%2C727730749%2C310455689%2C351996389%2C221308049%2C617744415%2C222335592%2C220021334%2C625572180%2C586430472%2C136515969%2C350544130%2C292528042%2C672835793%2C233271745%2C634818096%2C345014116%2C194674830%2C613079007%2C219240973%2C250830766%2C157946069%2C242071122%2C220940419%2C356904608%2C447921720%2C325876880%2C303520330%2C577977645%2C258583921%2C329292478%2C302734389%2C288394390%2C304744944%2C213828110%2C158384606%2C322256287%2C654816296%2C321085206%2C180526491%2C151836932%2C240510101%2C259932466%2C340422811%2C120417156%2C308158931%2C242970980%2C265004302%2C225515495%2C94470145%2C147235179%2C193641840%2C192956375%2C243086787%2C418406040%2C319849669%2C361549280%2C348894700%2C357040427%2C482437833%2C252638815%2C465024060%2C465229422%2C450607776%2C329511908%2C493285392%2C489363333%2C502948368%2C509000139%2C411189549%2C290210997%2C519271257%2C519206883%2C604903338%2C578505426%2C560864886%2C556088364%2C546188349%2C516324954%2C145367831%2C323733248%2C135322127%2C353880398%2C396944928%2C296968053%2C494976372%2C215558123%2C190445096%2C192408098%2C242672575%2C204778816%2C319887152%2C403960782%2C194510401%2C214816945%2C383884892%2C341315415%2C172595409%2C210014181%2C519749160%2C226139958%2C483679920%2C84118776%2C473381727%2C214140973%2C489177243%2C266963313%2C285262888%2C272020529&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
method: 'get',
headers: [Object],
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfHeaderName: 'X-XSRF-TOKEN',
maxBodyLength: -1,
},
_events: [Object: null prototype],
_maxListeners: undefined,
writable: true,
chunkedEncoding: false,
useChunkedEncodingByDefault: false,
_removedConnection: false,
_contentLength: 0,
_trailer: '',
_headerSent: true,
connection: [TLSSocket],
'Accept: application/json, text/plain, */*\r\n' +
'User-Agent: axios/0.20.0\r\n' +
'\r\n',
agent: [Agent],
socketPath: undefined,
insecureHTTPParser: undefined,
_ended: true,
timeoutCb: null,
[Symbol(kNeedDrain)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype]
data: {}
isAxiosError: true,
}
Recently i got this error
Error: Invalid date object from 'date' in client_id.json
how i can solve it?
I get this error when I build.
When i run with ts-node everything is fine.
"node": "^14.15.4",
"soundcloud-downloader": "^1.0.0",
"typescript": "^4.2.4"
// tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": false,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": [
"node_modules/*"
]
},
},
"include": [
"src/**/*"
]
}
The following query parameters are necessary to retrieve these tracks:
&playlistId=<PLAYLIST ID>&playlistSecretToken=<PLAYLIST SECRET TOKEN>
I am updated to the latest version. Tried another soundcloud id. The url is correct. Help
looks like you have deleted console.log which is in src/info.js, but in dist/info.js there is still one console.log on line 86. It's really annoying because it fills my terminal every time the request fails.
i think soundcloud changed the api and we cant get it in dev tools anymore
can you guys help me another way to get that api code pls
I have started to get 404 forbidden when i tried it out now.
EDIT: turns out certain songs don't work and will result in a 404 an example is:
https://soundcloud.com/the1975/tootimetootimetootime
When using the downloadPlaylist function, I get an error: UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'url' of undefined
..
It would be convenient to be able to retrieve information on the tracks a user has liked. The API endpoint looks like this:
https://api-v2.soundcloud.com/users/<user_ID>/likes?client_id=<client_id>&limit=10&offset=0
A user's ID can be retrieved using the link to their profile with the resolve endpoint, so I'm thinking this feature could be implemented like so:
const profileURL = 'https://soundcloud.com/<username>'
let likes = await getLikes(profileURL) // Gets the user's id for you, then calls the likes endpoint
// Or with user ID
likes = await getLikes(123123123123)
Hey, i started using your module in my bot after your pull request which was version 0.0.9 of your project, currently that version is working fine but after trying to update to 0.1.2 and refactor for the new changes i get error 404 on all links from the download method
I tested with this example
const scdl = require("soundcloud-downloader");
let url = "https://soundcloud.com/marcelonunes-2/pearl-jam-yellow-led-better";
const info = await scdl.getInfo(url, SOUNDCLOUD_CLIENT_ID);
const opus = scdl.filterMedia(info.media.transcodings, { format: scdl.FORMATS.OPUS });
stream = await scdl.download(opus[0].url, SOUNDCLOUD_CLIENT_ID);
I tried different songs and all are rejecting with error 404
Environment:
Randomly started getting this error about 30 minutes ago. Never happened before.
Error: connect ECONNREFUSED 127.0.0.1:443
Seems like you provided wrong url in README and all links is not working including scdl documentation. Can you update README documentation links or put it to wiki section to improve library usage?
I got this error when i try to run my discord music bot today, it worked just find just then. I dont know why.
Here is the full error:
/home/watchandytw/Cute_Lemon's BOT :D/Music BOT/node_modules/soundcloud-downloader/dist/index.js:92
this.saveClientID = process.env.SAVE_CLIENT_ID.toLowerCase() === 'true';
^
TypeError: Cannot read property 'toLowerCase' of undefined
at new SCDL (/home/watchandytw/Cute_Lemon's BOT :D/Music BOT/node_modules/soundcloud-downloader/dist/index.js:92:56)
at Object.<anonymous> (/home/watchandytw/Cute_Lemon's BOT :D/Music BOT/node_modules/soundcloud-downloader/dist/index.js:369:12)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/home/watchandytw/Cute_Lemon's BOT :D/Music BOT/node_modules/soundcloud-downloader/index.js:1:14)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
After updating to 0.2.1 I am getting this error
(node:9432) UnhandledPromiseRejectionWarning: TypeError: scdl.isValidUrl is not a function
Usage:
const scdl = require("soundcloud-downloader");
scdl.isValidUrl(url)
When I do:
scdl.isPlaylistURL("https://soundcloud.app.goo.gl/k6d2hrY5XJsPncZ26")
It will return false although that link is belong to a Soundcloud playlist.
getSetInfo()
makes a call to SoundCloud's API endpoints for fetching track details, but the response is out of order and then concatenated to the playlist's track array.
Apparently each time doing scdl.getSetInfo()
will always get this:
{
artwork_url: null,
created_at: '2022-11-03T01:10:39Z',
description: null,
duration: 379115,
embeddable_by: 'all',
genre: '',
id: 1521503137,
kind: 'playlist',
label_name: null,
last_modified: '2022-11-03T01:10:39Z',
license: 'all-rights-reserved',
likes_count: 7,
managed_by_feeds: false,
permalink: 'natasha-bedingfield-unwritten',
permalink_url: 'https://soundcloud.com/matthibbertmusic/sets/natasha-bedingfield-unwritten',
public: true,
purchase_title: null,
purchase_url: null,
release_date: null,
reposts_count: 0,
secret_token: null,
sharing: 'public',
tag_list: '',
title: 'Natasha Bedingfield - Unwritten (Matt Hibbert Edit) (Filtered for SC, full vocal in DL)',
...
}
everything else is fine except for artwork_url
, why is that??? it's very annoying to always get null for this when clearly playlists like this one has an artwork_url
8 const trackNames = []
~~~~~~~~~~
node_modules/soundcloud-downloader/src/download-playlist.ts:10:24 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
10 const p = download(track.permalink_url, clientID, axiosInstance)
~~~~~~~~~~~~~~~~~~~
node_modules/soundcloud-downloader/src/download-playlist.ts:15:19 - error TS7005: Variable 'trackNames' implicitly has an 'any[]' type.
15 return [result, trackNames]
~~~~~~~~~~
node_modules/soundcloud-downloader/src/download.ts:91:29 - error TS2532: Object is possibly 'undefined'.
91 return await fromMediaObj(info.media.transcodings[0], clientID, axiosInstance)
~~~~~~~~~~
node_modules/soundcloud-downloader/src/index.ts:1:19 - error TS7016: Could not find a declaration file for module 'soundcloud-key-fetch'. 'D:/Bernd/BerndPC/Documents/Github/Javascript/Discord-MusicBot/node_modules/soundcloud-key-fetch/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/soundcloud-key-fetch` if it exists or add a new declaration (.d.ts) file containing `declare module 'soundcloud-key-fetch';`
1 import sckey from 'soundcloud-key-fetch'
~~~~~~~~~~~~~~~~~~~~~~
node_modules/soundcloud-downloader/src/index.ts:24:32 - error TS2532: Object is possibly 'undefined'.
24 const filtered = filterMedia(info.media.transcodings, { format: format })
~~~~~~~~~~
node_modules/soundcloud-downloader/src/index.ts:51:3 - error TS2564: Property 'STREAMING_PROTOCOLS' has no initializer and is not definitely assigned in the constructor.
51 STREAMING_PROTOCOLS: { [key: string]: STREAMING_PROTOCOLS }
~~~~~~~~~~~~~~~~~~~
node_modules/soundcloud-downloader/src/index.ts:52:3 - error TS2564: Property 'FORMATS' has no initializer and is not definitely assigned in the constructor.
52 FORMATS: { [key: string]: FORMATS }
~~~~~~~
node_modules/soundcloud-downloader/src/index.ts:57:3 - error TS2564: Property 'axios' has no initializer and is not definitely assigned in the constructor.
57 axios: AxiosInstance
~~~~~
node_modules/soundcloud-downloader/src/index.ts:247:5 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
247 return this._clientID
~~~~~~~~~~~~~~~~~~~~~
node_modules/soundcloud-downloader/src/index.ts:274:7 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
274 return this._clientID
~~~~~~~~~~~~~~~~~~~~~
node_modules/soundcloud-downloader/src/index.ts:287:7 - error TS2769: No overload matches this call.
Overload 1 of 4, '(path: number | PathLike, options: { encoding?: null | undefined; flag?: string | undefined; } | null | undefined, callback: (err: ErrnoException | null, data: Buffer) => void): void', gave the following error.
Argument of type '"utf8"' is not assignable to parameter of type '{ encoding?: null | undefined; flag?: string | undefined; } | null | undefined'.
Overload 2 of 4, '(path: number | PathLike, options: string | { encoding: string; flag?: string | undefined; }, callback: (err: ErrnoException | null, data: string) => void): void', gave the following error.
Argument of type '(err: NodeJS.ErrnoException, data: string) => void' is not assignable to parameter of type '(err: ErrnoException | null, data: string) => void'.
Types of parameters 'err' and 'err' are incompatible.
Type 'ErrnoException | null' is not assignable to type 'ErrnoException'.
Type 'null' is not assignable to type 'ErrnoException'.
Overload 3 of 4, '(path: number | PathLike, options: string | { encoding?: string | null | undefined; flag?: string | undefined; } | null | undefined, callback: (err: ErrnoException | null, data: string | Buffer) => void): void', gave the following error.
Argument of type '(err: NodeJS.ErrnoException, data: string) => void' is not assignable to parameter of type '(err: ErrnoException | null, data: string | Buffer) => void'.
Types of parameters 'err' and 'err' are incompatible.
Type 'ErrnoException | null' is not assignable to type 'ErrnoException'.
Type 'null' is not assignable to type 'ErrnoException'.
287 fs.readFile(filename, 'utf8', (err: NodeJS.ErrnoException, data: string) => {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
288 if (err) return reject(err)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
309 }
~~~~~~~~~
310 })
~~~~~~~~
node_modules/soundcloud-downloader/src/index.ts:322:31 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
322 if (isFirebaseURL(url)) url = await convertFirebaseURL(url, this.axios)
~~~
node_modules/soundcloud-downloader/src/info.ts:168:24 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'.
168 splitIds[i].push(ids[x])
~~~~~~
node_modules/soundcloud-downloader/src/likes.ts:43:23 - error TS2532: Object is possibly 'undefined'.
43 while (nextHref && (options.limit > 0 || options.limit === -1)) {
~~~~~~~~~~~~~
node_modules/soundcloud-downloader/src/likes.ts:53:89 - error TS2769: No overload matches this call.
Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
Argument of type 'Like' is not assignable to parameter of type 'ConcatArray<never>'.
Type 'Like' is missing the following properties from type 'ConcatArray<never>': length, join, slice
Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
Argument of type 'Like' is not assignable to parameter of type 'ConcatArray<never>'.
53 query.collection = query.collection.reduce((prev, curr) => curr.track ? prev.concat(curr) : prev, [])
~~~~
node_modules/soundcloud-downloader/src/likes.ts:54:10 - error TS2454: Variable 'response' is used before being assigned.
54 if (!response) {
~~~~~~~~
node_modules/soundcloud-downloader/src/likes.ts:63:7 - error TS2532: Object is possibly 'undefined'.
63 options.limit -= query.collection.length
~~~~~~~~~~~~~
node_modules/soundcloud-downloader/src/likes.ts:65:11 - error TS2532: Object is possibly 'undefined'.
~~~~~~~~~~~~~
node_modules/soundcloud-downloader/src/likes.ts:79:10 - error TS2454: Variable 'response' is used before being assigned.
79 return response
~~~~~~~~
Found 20 errors.```
This is the error log from tsc
I think you should include a tiny guide on how to use with Discord.JS.
i.e get file, play it and clear it after the file has been played.
even though I think adding a way to stream the audio directly via a link would be better(which is basically already on your to-do list)
Is there any ability to add more information about a track, such as an image, time, Age, etc ... ?!
C:\Users\33647\Desktop\News\node_modules\soundcloud-downloader\dist\index.js:92
this.saveClientID = process.env.SAVE_CLIENT_ID.toLowerCase() === 'true';
^
TypeError: Cannot read property 'toLowerCase' of undefined
at new SCDL (C:\Users\33647\Desktop\News\node_modules\soundcloud-downloader\dist\index.js:92:56)
at Object. (C:\Users\33647\Desktop\News\node_modules\soundcloud-downloader\dist\index.js:369:12)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object. (C:\Users\33647\Desktop\News\node_modules\soundcloud-downloader\index.js:1:14)
at Module._compile (internal/modules/cjs/loader.js:776:30)
[nodemon] app crashed - waiting for file changes before starting...
=== npm audit security report ===
┌──────────────────────────────────────────────────────────────────────────────┐
│ Manual Review │
│ Some vulnerabilities require your attention to resolve │
│ │
│ Visit https://go.npm.me/audit-guide for additional guidance │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ minimist │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=0.2.1 <1.0.0 || >=1.2.3 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ soundcloud │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ soundcloud > node-static > optimist > minimist │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1179 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low │ Unauthorized File Access │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ node-static │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ No patch available │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ soundcloud │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ soundcloud > node-static │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1206 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low │ Open Redirect │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ node-static │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ No patch available │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ soundcloud │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ soundcloud > node-static │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1207 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Denial of Service │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ node-static │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ No patch available │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ soundcloud │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ soundcloud > node-static │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1208 │
└───────────────┴──────────────────────────────────────────────────────────────┘
found 4 vulnerabilities (3 low, 1 high) in 146 scanned packages
4 vulnerabilities require manual review. See the full report for details.
Thank you for making this repo, and streaming soundcloud music possible. I've encounter the following problem when using it.
Here is a picture of the console.log() prints out after calling await scdl.getSetInfo(url)
. This happens on any playlist url, https://soundcloud.com/user-845046062/sets/playlist for example.
When I go to the playlist link and copy the track url that doesn't have the info printed and use `scdl.getInfo(url), it shows all the track info normally.
Any clues? Could it be that I'm not providing a ClienID?
Thank you so much!
Hi,
Thanks for this repo, however I can't manage to download any track due to a rejected promise.
I followed the steps (providing a CLIENT_ID from soundcloud from the Chrome DevTools Network's tab), trying both with and without CLIENT_ID, similarly resulting in the following undhandled promise rejection:
(node:20171) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'transcodings' of undefined at /Users/davidthery/Desktop/node_modules/soundcloud-downloader/dist/index.js:58:73 at step (/Users/davidthery/Desktop/node_modules/soundcloud-downloader/dist/index.js:33:23) at Object.next (/Users/davidthery/Desktop/node_modules/soundcloud-downloader/dist/index.js:14:53) at fulfilled (/Users/davidthery/Desktop/node_modules/soundcloud-downloader/dist/index.js:5:58) at processTicksAndRejections (internal/process/task_queues.js:93:5) (Use
node --trace-warnings ...to show where the warning was created) (node:20171) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:20171) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I'm using Node v14.6.0.
If you have any clue?
Thanks,
David
When you use the search method, the response is a paginated query with the field "next_href". The collection of tracks field is an array that is limited to 10 values.
So trying to visit "next_href" link to get the remaining collection of tracks results in an error.
node 47028 ubuntu 163u IPv4 1384716 0t0 TCP MYIP:51314->server-52-84-229-94.sin2.r.cloudfront.net:https (CLOSE_WAIT)
node 47028 ubuntu 167u IPv4 1384730 0t0 TCP MYIP:51318->server-52-84-229-94.sin2.r.cloudfront.net:https (CLOSE_WAIT)
node 47028 ubuntu 169u IPv4 1384727 0t0 TCP MYIP:51316->server-52-84-229-94.sin2.r.cloudfront.net:https (CLOSE_WAIT)
node 47028 ubuntu 170u IPv4 1387572 0t0 TCP MYIP:52174->server-13-35-20-66.sin5.r.cloudfront.net:https (ESTABLISHED)
node 47028 ubuntu 172u IPv4 1388618 0t0 TCP MYIP:51574->server-52-84-229-94.sin2.r.cloudfront.net:https (CLOSE_WAIT)
When I play the music by discord bot (using this library), the bot has many close_wait connection.
This leads to waste of resources.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.