mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
Types Improved
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { request } from './utils/request';
|
||||
import { ParseSearchInterface, ParseSearchResult } from './utils/parser';
|
||||
import { Video } from './classes/Video';
|
||||
import { Channel } from './classes/Channel';
|
||||
import { PlayList } from './classes/Playlist';
|
||||
import { YouTubeVideo } from './classes/Video';
|
||||
import { YouTubeChannel } from './classes/Channel';
|
||||
import { YouTubePlayList } from './classes/Playlist';
|
||||
|
||||
enum SearchType {
|
||||
Video = 'EgIQAQ%253D%253D',
|
||||
@@ -10,10 +10,9 @@ enum SearchType {
|
||||
Channel = 'EgIQAg%253D%253D'
|
||||
}
|
||||
|
||||
export async function yt_search(
|
||||
search: string,
|
||||
options: ParseSearchInterface = {}
|
||||
): Promise<(Video | Channel | PlayList)[]> {
|
||||
export type YouTube = YouTubeVideo | YouTubeChannel | YouTubePlayList;
|
||||
|
||||
export async function yt_search(search: string, options: ParseSearchInterface = {}): Promise<YouTube[]> {
|
||||
let url = 'https://www.youtube.com/results?search_query=' + search.replaceAll(' ', '+');
|
||||
options.type ??= 'video';
|
||||
if (!url.match('&sp=')) {
|
||||
|
||||
Reference in New Issue
Block a user