mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
search validation added
This commit is contained in:
@@ -260,7 +260,7 @@ export class Stream {
|
||||
}
|
||||
|
||||
private async loop() {
|
||||
if (this.stream.destroyed ||this.time.length === 0 || this.segment_urls.length === 0) {
|
||||
if (this.stream.destroyed || this.time.length === 0 || this.segment_urls.length === 0) {
|
||||
this.cleanup();
|
||||
return;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ export class Stream {
|
||||
return;
|
||||
}
|
||||
|
||||
this.request = stream
|
||||
this.request = stream;
|
||||
stream.pipe(this.stream, { end: false });
|
||||
stream.on('end', () => {
|
||||
if (this.downloaded_time >= 300) return;
|
||||
|
||||
@@ -126,8 +126,8 @@ export async function check_id(id: string): Promise<boolean> {
|
||||
* @param url soundcloud url
|
||||
* @returns "false" | 'track' | 'playlist'
|
||||
*/
|
||||
export async function so_validate(url: string): Promise<false | 'track' | 'playlist'> {
|
||||
if (!url.match(pattern)) return false;
|
||||
export async function so_validate(url: string): Promise<false | 'track' | 'playlist' | 'search'> {
|
||||
if (!url.match(pattern)) return 'search';
|
||||
const data = await request(
|
||||
`https://api-v2.soundcloud.com/resolve?url=${url}&client_id=${soundData.client_id}`
|
||||
).catch((err: Error) => err);
|
||||
|
||||
Reference in New Issue
Block a user