mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-06 04:32:40 +00:00
Stream and Validate fixes
This commit is contained in:
@@ -127,11 +127,12 @@ export async function check_id(id: string): Promise<boolean> {
|
||||
* @returns "false" | 'track' | 'playlist'
|
||||
*/
|
||||
export async function so_validate(url: string): Promise<false | 'track' | 'playlist'> {
|
||||
if (!url.match(pattern)) return false;
|
||||
const data = await request(
|
||||
`https://api-v2.soundcloud.com/resolve?url=${url}&client_id=${soundData.client_id}`
|
||||
).catch((err: Error) => err);
|
||||
|
||||
if (data instanceof Error) throw data;
|
||||
if (data instanceof Error) return false;
|
||||
|
||||
const json_data = JSON.parse(data);
|
||||
if (json_data.kind === 'track') return 'track';
|
||||
|
||||
Reference in New Issue
Block a user