mirror of
https://codeberg.org/lucida/lucida.git
synced 2026-11-12 14:47:24 -05:00
fix soundcloud bug
This commit is contained in:
11
run.js
Normal file
11
run.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import Lucida from './build/index.js';
|
||||
import Soundcloud from './build/streamers/soundcloud/main.js'
|
||||
|
||||
const lucida = new Lucida({
|
||||
modules: {
|
||||
soundcloud: new Soundcloud({"oauthToken": "2-294707-1346470389-4thCm1p3QnA05"})
|
||||
},
|
||||
logins: {}
|
||||
});
|
||||
|
||||
console.log(await lucida.search("ram ranch"))
|
||||
@@ -55,11 +55,10 @@ export default class Soundcloud implements Streamer {
|
||||
if (!response.ok) {
|
||||
const errMsg = await response.text()
|
||||
try {
|
||||
console.error('Soundcloud error response:', JSON.parse(errMsg))
|
||||
throw new Error(JSON.parse(errMsg))
|
||||
} catch (error) {
|
||||
console.error('Soundcloud error response:', errMsg)
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
throw new Error(`Searching Soundcloud failed with status code ${response.status}.`)
|
||||
}
|
||||
|
||||
const resultResponse = <RawSearchResults>await response.json()
|
||||
@@ -233,7 +232,8 @@ async function fetchKey(response: string) {
|
||||
if (typeof streamKey == 'string') continue
|
||||
|
||||
const key = keys[i].split(`"`)[0]
|
||||
if (!key.startsWith('https://a-v2.sndcdn.com/assets/50-')) continue
|
||||
const keyregex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/
|
||||
if (!keyregex.test(key)) continue
|
||||
|
||||
const script = await (await fetch(key)).text()
|
||||
if (script.split(`,client_id:"`).length > 1 && !streamKey) {
|
||||
|
||||
Reference in New Issue
Block a user