Comparing version 0.0.74 to 0.0.75
@@ -76,5 +76,5 @@ export default { | ||
"deviceModel": "", | ||
"userAgent": "com.google.android.apps.youtube.music/5.46.52 (Linux; U; Android 13; GB) gzip", | ||
"userAgent": "com.google.android.apps.youtube.music/6.14.50 (Linux; U; Android 13; GB) gzip", | ||
"clientName": "ANDROID_MUSIC", | ||
"clientVersion": "5.46.52", | ||
"clientVersion": "6.14.50", | ||
"osName": "Android", | ||
@@ -81,0 +81,0 @@ "osVersion": "13", |
@@ -182,10 +182,42 @@ import CONSTANTS2 from "../constants-ng.js"; | ||
const json = await request_json("browse", { | ||
data: { browseId }, | ||
data: { browseId, ...CONSTANTS2.ANDROID.DATA }, | ||
signal: options.signal, | ||
}); | ||
const lyrics = { | ||
lyrics: jo(json, "contents", SECTION_LIST_ITEM, DESCRIPTION_SHELF, DESCRIPTION), | ||
source: jo(json, "contents", SECTION_LIST_ITEM, DESCRIPTION_SHELF, "footer", RUN_TEXT), | ||
}; | ||
return lyrics; | ||
const synced_data = jo(json, "contents.elementRenderer.newElement.type.componentType.model.timedLyricsModel.lyricsData"); | ||
if (synced_data) { | ||
const lyrics = { | ||
timed: true, | ||
source: jo(synced_data, "sourceMessage"), | ||
lyrics: jo(synced_data, "timedLyricsData") | ||
?.map((line) => { | ||
return line.lyricLine; | ||
}) | ||
.map((line) => { | ||
if (line === "♪") { | ||
return "\n"; | ||
} | ||
return line; | ||
}) | ||
.join("\n") | ||
.trim(), | ||
timed_lyrics: jo(synced_data, "timedLyricsData") | ||
?.map((line) => { | ||
return { | ||
line: line.lyricLine, | ||
start: +line.cueRange.startTimeMilliseconds, | ||
end: +line.cueRange.endTimeMilliseconds, | ||
id: line.cueRange.metadata.id, | ||
}; | ||
}) ?? [], | ||
}; | ||
return lyrics; | ||
} | ||
else { | ||
const lyrics = { | ||
timed: false, | ||
lyrics: jo(json, "contents", SECTION_LIST_ITEM, DESCRIPTION_SHELF, DESCRIPTION), | ||
source: jo(json, "contents", SECTION_LIST_ITEM, DESCRIPTION_SHELF, "footer", RUN_TEXT), | ||
}; | ||
return lyrics; | ||
} | ||
} | ||
@@ -192,0 +224,0 @@ export async function get_artist_albums(channelId, params, options = {}) { |
@@ -6,3 +6,3 @@ { | ||
"name": "libmuse", | ||
"version": "0.0.74", | ||
"version": "0.0.75", | ||
"description": "A library to interact with the YouTube Music (InnerTube) api.", | ||
@@ -9,0 +9,0 @@ "tags": [ |
@@ -78,5 +78,5 @@ "use strict"; | ||
"deviceModel": "", | ||
"userAgent": "com.google.android.apps.youtube.music/5.46.52 (Linux; U; Android 13; GB) gzip", | ||
"userAgent": "com.google.android.apps.youtube.music/6.14.50 (Linux; U; Android 13; GB) gzip", | ||
"clientName": "ANDROID_MUSIC", | ||
"clientVersion": "5.46.52", | ||
"clientVersion": "6.14.50", | ||
"osName": "Android", | ||
@@ -83,0 +83,0 @@ "osVersion": "13", |
@@ -195,10 +195,42 @@ "use strict"; | ||
const json = await (0, _request_js_1.request_json)("browse", { | ||
data: { browseId }, | ||
data: { browseId, ...constants_ng_js_1.default.ANDROID.DATA }, | ||
signal: options.signal, | ||
}); | ||
const lyrics = { | ||
lyrics: (0, util_js_1.jo)(json, "contents", nav_js_1.SECTION_LIST_ITEM, nav_js_1.DESCRIPTION_SHELF, nav_js_1.DESCRIPTION), | ||
source: (0, util_js_1.jo)(json, "contents", nav_js_1.SECTION_LIST_ITEM, nav_js_1.DESCRIPTION_SHELF, "footer", nav_js_1.RUN_TEXT), | ||
}; | ||
return lyrics; | ||
const synced_data = (0, util_js_1.jo)(json, "contents.elementRenderer.newElement.type.componentType.model.timedLyricsModel.lyricsData"); | ||
if (synced_data) { | ||
const lyrics = { | ||
timed: true, | ||
source: (0, util_js_1.jo)(synced_data, "sourceMessage"), | ||
lyrics: (0, util_js_1.jo)(synced_data, "timedLyricsData") | ||
?.map((line) => { | ||
return line.lyricLine; | ||
}) | ||
.map((line) => { | ||
if (line === "♪") { | ||
return "\n"; | ||
} | ||
return line; | ||
}) | ||
.join("\n") | ||
.trim(), | ||
timed_lyrics: (0, util_js_1.jo)(synced_data, "timedLyricsData") | ||
?.map((line) => { | ||
return { | ||
line: line.lyricLine, | ||
start: +line.cueRange.startTimeMilliseconds, | ||
end: +line.cueRange.endTimeMilliseconds, | ||
id: line.cueRange.metadata.id, | ||
}; | ||
}) ?? [], | ||
}; | ||
return lyrics; | ||
} | ||
else { | ||
const lyrics = { | ||
timed: false, | ||
lyrics: (0, util_js_1.jo)(json, "contents", nav_js_1.SECTION_LIST_ITEM, nav_js_1.DESCRIPTION_SHELF, nav_js_1.DESCRIPTION), | ||
source: (0, util_js_1.jo)(json, "contents", nav_js_1.SECTION_LIST_ITEM, nav_js_1.DESCRIPTION_SHELF, "footer", nav_js_1.RUN_TEXT), | ||
}; | ||
return lyrics; | ||
} | ||
} | ||
@@ -205,0 +237,0 @@ exports.get_lyrics = get_lyrics; |
@@ -84,6 +84,20 @@ import { AlbumHeader } from "../parsers/albums.js"; | ||
export declare function get_song_related(browseId: string, options?: AbortOptions): Promise<MixedContent[]>; | ||
export interface Lyrics { | ||
export interface BaseTimedLyrics { | ||
lyrics: string; | ||
source: string; | ||
timed: boolean; | ||
} | ||
export interface UnTimedLyrics extends BaseTimedLyrics { | ||
timed: false; | ||
} | ||
export interface TimedLyrics extends BaseTimedLyrics { | ||
timed: true; | ||
timed_lyrics: { | ||
line: string; | ||
start: number; | ||
end: number; | ||
id: string; | ||
}[]; | ||
} | ||
export type Lyrics = TimedLyrics | UnTimedLyrics; | ||
export declare function get_lyrics(browseId: string, options?: AbortOptions): Promise<Lyrics>; | ||
@@ -90,0 +104,0 @@ export interface ArtistAlbums { |
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
869992
17889