how to get youtube music album art in nestjs

Viewed 35

I'm using nestjs and I want to get album art from youtube-music.

Is there no way to get youtubeMusic's album art using nestCrawlerService?

private readonly crawler: NestCrawlerService
//...
await this.crawler.fetch({
          target: 'https://music.youtube.com/playlist?list=OLAK5uy_nsZm9AscLdmJf4wE2Af8D3JvFzfPCKdEs',
          fetch: {
            info: {
              selector: 'div#thumbnail img#img',
              attr: 'src',
            },
          },
        });

From the link above (actual) I want to get Jackson's album cover.

enter image description here

1 Answers

I'm not familiar with , but, I would target the meta tag and get its property value.

Example:

<meta property="og:image" content="https://lh3.googleusercontent.com/acFvHA1OEoI0HBPPG33zidd9n9aG1OTvo7XQQeFjEeQObGv6R3464BvFijHerp3Sit5UeHvQnx6LMoE=w544-h544-l90-rj">

If you manage to get the content value of the sad meta tag, you will get your desired result.

Result:

pfp_piccture
Related