code made prettier
This commit is contained in:
parent
3416cd493f
commit
5d1b5af75a
@ -89,17 +89,17 @@ export async function stream(url: string, quality?: number): Promise<Stream> {
|
|||||||
* Function to get Free Client ID of soundcloud.
|
* Function to get Free Client ID of soundcloud.
|
||||||
* @returns client ID
|
* @returns client ID
|
||||||
*/
|
*/
|
||||||
export async function getFreeClientID(): Promise<string>{
|
export async function getFreeClientID(): Promise<string> {
|
||||||
const data = await request('https://soundcloud.com/')
|
const data = await request('https://soundcloud.com/');
|
||||||
const splitted = data.split('<script crossorigin src="')
|
const splitted = data.split('<script crossorigin src="');
|
||||||
const urls: string[] = []
|
const urls: string[] = [];
|
||||||
splitted.forEach((r) => {
|
splitted.forEach((r) => {
|
||||||
if(r.startsWith('https')) {
|
if (r.startsWith('https')) {
|
||||||
urls.push(r.split('"')[0])
|
urls.push(r.split('"')[0]);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
const data2 = await request(urls[urls.length - 1])
|
const data2 = await request(urls[urls.length - 1]);
|
||||||
return data2.split(',client_id:"')[1].split('"')[0]
|
return data2.split(',client_id:"')[1].split('"')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -148,7 +148,7 @@ export class SpotifyPlaylist {
|
|||||||
if (typeof response !== 'string') return;
|
if (typeof response !== 'string') return;
|
||||||
const json_data = JSON.parse(response);
|
const json_data = JSON.parse(response);
|
||||||
json_data.items.forEach((v: any) => {
|
json_data.items.forEach((v: any) => {
|
||||||
if(v.track) videos.push(new SpotifyTrack(v.track));
|
if (v.track) videos.push(new SpotifyTrack(v.track));
|
||||||
});
|
});
|
||||||
this.fetched_tracks.set(`${i}`, videos);
|
this.fetched_tracks.set(`${i}`, videos);
|
||||||
resolve('Success');
|
resolve('Success');
|
||||||
@ -254,7 +254,7 @@ export class SpotifyAlbum {
|
|||||||
if (typeof response !== 'string') return;
|
if (typeof response !== 'string') return;
|
||||||
const json_data = JSON.parse(response);
|
const json_data = JSON.parse(response);
|
||||||
json_data.items.forEach((v: any) => {
|
json_data.items.forEach((v: any) => {
|
||||||
if(v) videos.push(new SpotifyTrack(v));
|
if (v) videos.push(new SpotifyTrack(v));
|
||||||
});
|
});
|
||||||
this.fetched_tracks.set(`${i}`, videos);
|
this.fetched_tracks.set(`${i}`, videos);
|
||||||
resolve('Success');
|
resolve('Success');
|
||||||
|
|||||||
@ -1,8 +1 @@
|
|||||||
export {
|
export { video_basic_info, video_info, decipher_info, playlist_info, yt_validate, extractID } from './extractor';
|
||||||
video_basic_info,
|
|
||||||
video_info,
|
|
||||||
decipher_info,
|
|
||||||
playlist_info,
|
|
||||||
yt_validate,
|
|
||||||
extractID
|
|
||||||
} from './extractor';
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user