@dofiltra/youtube
Advanced tools
Comparing version 1.1.22 to 1.1.23
@@ -0,1 +1,3 @@ | ||
/* tslint:disable:no-console */ | ||
/* tslint:disable:no-debugger */ | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -14,3 +16,4 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
static async start({}) { | ||
const res = await searchVideo({ searchQuery: 'top 10 music' }); | ||
const res = await searchVideo({ searchQuery: 'catnap' }); | ||
debugger; | ||
return { result: {} }; | ||
@@ -17,0 +20,0 @@ } |
@@ -0,3 +1,4 @@ | ||
import type { TYtSearchVideoItem } from '@dofiltra/types'; | ||
export declare class ParserService { | ||
parseVideo(data: any): { | ||
parseVideo(data: any): TYtSearchVideoItem | { | ||
id: { | ||
@@ -8,3 +9,3 @@ videoId: any; | ||
title: string; | ||
description: any; | ||
description: string; | ||
duration_raw: any; | ||
@@ -27,3 +28,6 @@ snippet: { | ||
views: any; | ||
channel: { | ||
isVerified: any; | ||
}; | ||
} | undefined; | ||
} |
@@ -5,2 +5,3 @@ export class ParserService { | ||
return undefined; | ||
let result = {}; | ||
try { | ||
@@ -18,3 +19,4 @@ let title = ''; | ||
} | ||
return { | ||
result = { | ||
...result, | ||
id: { | ||
@@ -46,8 +48,10 @@ videoId: renderer.videoId, | ||
}, | ||
views: renderer.viewCountText && renderer.viewCountText.simpleText | ||
? renderer.viewCountText.simpleText.replace(/[^0-9]/g, '') | ||
: 0, | ||
views: renderer?.viewCountText?.simpleText?.replace?.(/[^0-9]/g, '') || 0, | ||
channel: { | ||
isVerified: renderer?.ownerBadges?.[0]?.metadataBadgeRenderer?.tooltip, | ||
}, | ||
}; | ||
return result; | ||
} | ||
else if (data.videoWithContextRenderer) { | ||
if (data.videoWithContextRenderer) { | ||
if (data.videoWithContextRenderer.headline?.runs && data.videoWithContextRenderer.headline?.runs.length > 0) { | ||
@@ -91,12 +95,15 @@ title = data.videoWithContextRenderer.headline?.runs[0].text; | ||
}, | ||
views: data.videoWithContextRenderer.shortViewCountText?.accessibility?.accessibilityData?.label?.replace(/[^0-9]/g, ''), | ||
views: data.videoWithContextRenderer?.shortViewCountText?.accessibility?.accessibilityData?.label?.replace(/[^0-9]/g, ''), | ||
channel: { | ||
isVerified: data.videoWithContextRenderer?.ownerBadges?.[0]?.metadataBadgeRenderer?.tooltip, | ||
}, | ||
}; | ||
} | ||
return undefined; | ||
} | ||
catch (e) { | ||
return undefined; | ||
// | ||
} | ||
return undefined; | ||
} | ||
} | ||
//# sourceMappingURL=parser.service.js.map |
@@ -7,3 +7,3 @@ import { ProxyItem } from '@dofiltra/helpers'; | ||
sp?: string; | ||
}): Promise<{ | ||
}): Promise<(import("@dofiltra/types").TYtSearchVideoItem | { | ||
id: { | ||
@@ -14,3 +14,3 @@ videoId: any; | ||
title: string; | ||
description: any; | ||
description: string; | ||
duration_raw: any; | ||
@@ -33,2 +33,5 @@ snippet: { | ||
views: any; | ||
}[]>; | ||
channel: { | ||
isVerified: any; | ||
}; | ||
})[]>; |
{ | ||
"name": "@dofiltra/youtube", | ||
"version": "1.1.22", | ||
"version": "1.1.23", | ||
"description": "Search videos on YouTube without API key", | ||
@@ -9,3 +9,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"dev": "yarn run build && node --expose-gc --trace-warnings --experimental-modules --es-module-specifier-resolution=node ./build/debug.js", | ||
"dev": "yarn run build && node --expose-gc --trace-warnings --experimental-modules --es-module-specifier-resolution=node ./lib/debug.js", | ||
"test": "echo \"jest --config jestconfig.json\"", | ||
@@ -43,3 +43,3 @@ "build": "tsc", | ||
"devDependencies": { | ||
"@dofiltra/types": "^1.0.251", | ||
"@dofiltra/types": "^1.0.253", | ||
"@types/node": "^16.11.12", | ||
@@ -46,0 +46,0 @@ "prettier": "^2.5.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36330
288