Search fixed

This commit is contained in:
killer069 2021-10-05 11:09:41 +05:30
parent 0874f716dc
commit f30c4f458b
3 changed files with 3 additions and 3 deletions

View File

@ -117,7 +117,7 @@ export async function video_basic_info(url: string, options: InfoOptions = {}) {
description: vid.shortDescription, description: vid.shortDescription,
duration: vid.lengthSeconds, duration: vid.lengthSeconds,
duration_raw: parseSeconds(vid.lengthSeconds), duration_raw: parseSeconds(vid.lengthSeconds),
uploadedDate: microformat.publishDate, uploadedAt: microformat.publishDate,
thumbnail: vid.thumbnail.thumbnails[vid.thumbnail.thumbnails.length - 1], thumbnail: vid.thumbnail.thumbnails[vid.thumbnail.thumbnails.length - 1],
channel: { channel: {
name: vid.author, name: vid.author,

View File

@ -32,7 +32,7 @@ export function ParseSearchResult(html: string, options?: ParseSearchInterface):
.itemSectionRenderer.contents; .itemSectionRenderer.contents;
for (let i = 0; i < details.length; i++) { 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 (!details[i].videoRenderer && !details[i].channelRenderer && !details[i].playlistRenderer) continue;
if (options.type === 'video') { if (options.type === 'video') {
const parsed = parseVideo(details[i]); const parsed = parseVideo(details[i]);
if (!parsed) continue; if (!parsed) continue;

View File

@ -152,7 +152,7 @@ async function proxy_getter(req_url: string, req_proxy: Proxy[]): Promise<ProxyO
*/ */
export async function request(url: string, options?: RequestOpts): Promise<string> { export async function request(url: string, options?: RequestOpts): Promise<string> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (!options?.proxies) { if (!options?.proxies || options.proxies.length === 0) {
let data = ''; let data = '';
let res = await https_getter(url, options).catch((err: Error) => err); let res = await https_getter(url, options).catch((err: Error) => err);
if (res instanceof Error) { if (res instanceof Error) {