mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-06 04:32:40 +00:00
Search fixed
This commit is contained in:
@@ -31,7 +31,8 @@ export function ParseSearchResult(html: string, options?: ParseSearchInterface):
|
||||
json_data.contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents[0]
|
||||
.itemSectionRenderer.contents;
|
||||
for (let i = 0; i < details.length; i++) {
|
||||
if (typeof options.limit === 'number' && options.limit > 0 && results.length >= options.limit) break;
|
||||
if (typeof options.limit === 'number' && options.limit > 0 && results.length === options.limit) break;
|
||||
if(!details[i].videoRenderer && !details[i].channelRenderer && !details[i].playlistRenderer) continue;
|
||||
if (options.type === 'video') {
|
||||
const parsed = parseVideo(details[i]);
|
||||
if (!parsed) continue;
|
||||
@@ -154,7 +155,7 @@ export function parseVideo(data?: any): YouTubeVideo {
|
||||
* @returns YouTubePlaylist class
|
||||
*/
|
||||
export function parsePlaylist(data?: any): YouTubePlayList {
|
||||
if (!data.playlistRenderer) throw new Error('Failed to Parse YouTube Playlist');
|
||||
if (!data || !data.playlistRenderer) throw new Error('Failed to Parse YouTube Playlist');
|
||||
|
||||
const res = new YouTubePlayList(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user