Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit a6b0c45

Browse files
committed
Fix YT search playlist IDs
Fixes #274
1 parent 94bee40 commit a6b0c45

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/utils/main/fetchers/searchYT.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
* See LICENSE in the project root for license information.
88
*/
99

10+
import * as ytMusic from 'node-youtube-music'
11+
1012
import { CacheHandler } from './cacheFile'
11-
import { escapeRegExp } from '@/utils/common'
1213
import { app } from 'electron'
13-
import * as ytMusic from 'node-youtube-music'
14+
import { escapeRegExp } from '@/utils/common'
1415
import path from 'path'
1516
import ytdl from 'ytdl-core'
1617
import ytpl from 'ytpl'
@@ -173,8 +174,9 @@ export class YTScraper extends CacheHandler {
173174
private parseYoutubeMusicPlaylist(...playlist: ytMusic.PlaylistPreview[]): Playlist[] {
174175
const playlists: Playlist[] = []
175176
for (const a of playlist) {
177+
const parsedPlaylistId = a.playlistId?.startsWith('VL') ? a.playlistId.substring(2) : a.playlistId
176178
playlists.push({
177-
playlist_id: `youtube-author:${a.playlistId}`,
179+
playlist_id: `youtube-playlist:${parsedPlaylistId}`,
178180
playlist_name: a.title ?? '',
179181
playlist_coverPath: a.thumbnailUrl,
180182
})
@@ -514,6 +516,7 @@ export class YTScraper extends CacheHandler {
514516
songs = await ytpl.continueReq(page)
515517
}
516518
} catch (e) {
519+
console.error(e)
517520
return { songs: [] }
518521
}
519522

0 commit comments

Comments
 (0)