Fixed find chapter error, soundcloud 403 and watch playlists

This commit is contained in:
AtariTom
2023-09-24 13:59:51 -04:00
parent 76c237346e
commit 6a8569feb8
5 changed files with 25 additions and 13 deletions

View File

@@ -111,10 +111,14 @@ export async function stream(url: string, quality?: number): Promise<SoundCloudS
* @returns client ID
*/
export async function getFreeClientID(): Promise<string> {
const data = await request('https://soundcloud.com/');
const data: any = await request('https://soundcloud.com/', {headers: {}}).catch(err => err);
if (data instanceof Error)
throw new Error("Failed to get response from soundcloud.com: " + data.message);
const splitted = data.split('<script crossorigin src="');
const urls: string[] = [];
splitted.forEach((r) => {
splitted.forEach((r: string) => {
if (r.startsWith('https')) {
urls.push(r.split('"')[0]);
}