File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,16 +45,6 @@ interface YouTubeiResponse {
4545 }
4646}
4747
48- /** Watch page enrichment fields */
49- interface WatchPageData {
50- song ?: string
51- artist ?: string
52- album ?: string
53- thumbnailAlbum ?: string
54- channel ?: string
55- publishDate ?: string
56- }
57-
5848/** Extract a JSON variable assignment from YouTube HTML via brace-counting */
5949export function parseEmbeddedJson (
6050 html : string ,
@@ -81,8 +71,8 @@ export function parseEmbeddedJson(
8171}
8272
8373/** Extract watch page enrichment data from ytInitialData engagement panels */
84- function extractWatchPageData ( ytData : any ) : WatchPageData {
85- const data : WatchPageData = { }
74+ function extractWatchPageData ( ytData : any ) {
75+ const data : Record < string , string | undefined > = { }
8676 const panels = ytData ?. engagementPanels ?? [ ]
8777 for ( const panel of panels ) {
8878 const items =
@@ -116,7 +106,7 @@ function extractWatchPageData(ytData: any): WatchPageData {
116106}
117107
118108/** Fetch and parse YouTube watch page for enrichment data */
119- async function fetchWatchPage ( id : string ) : Promise < WatchPageData > {
109+ async function fetchWatchPage ( id : string ) {
120110 try {
121111 const response = await globalThis . fetch ( buildVideoUrl ( id ) , {
122112 headers : {
You can’t perform that action at this time.
0 commit comments