Use playlist thumbnail provided by YT (#3710)

* Use playlist thumbnail provided by YT from Local API

* Use correct thumbnails for playlist page

* Fix playlistThumbnail not giving correct value

* Update youtubei.js

* Update package.json

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

* Update yarn.lock to align with package.json

---------

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
This commit is contained in:
Jaden 2023-06-30 12:18:43 -04:00 committed by GitHub
parent afffbf69fc
commit fc7c252722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 7 deletions

View File

@ -77,7 +77,7 @@
"vue-router": "^3.6.5",
"vue-tiny-slider": "^0.1.39",
"vuex": "^3.6.2",
"youtubei.js": "^5.1.0"
"youtubei.js": "^5.2.0"
},
"devDependencies": {
"@babel/core": "^7.22.5",

View File

@ -17,6 +17,7 @@ export default defineComponent({
return {
id: '',
firstVideoId: '',
playlistThumbnail: '',
title: '',
channelThumbnail: '',
channelName: '',
@ -54,7 +55,7 @@ export default defineComponent({
if (this.backendPreference === 'invidious') {
baseUrl = this.currentInvidiousInstance
} else {
baseUrl = 'https://i.ytimg.com'
return this.data.playlistThumbnail
}
switch (this.thumbnailPreference) {

View File

@ -353,6 +353,8 @@ function parseShortDuration(accessibilityLabel, videoId) {
export function parseLocalListPlaylist(playlist, author = undefined) {
let channelName
let channelId = null
/** @type {import('youtubei.js').YTNodes.PlaylistVideoThumbnail} */
const thumbnailRenderer = playlist.thumbnail_renderer
if (playlist.author) {
if (playlist.author instanceof Misc.Text) {
@ -374,7 +376,7 @@ export function parseLocalListPlaylist(playlist, author = undefined) {
type: 'playlist',
dataSource: 'local',
title: playlist.title.text,
thumbnail: playlist.thumbnails[0].url,
thumbnail: thumbnailRenderer ? thumbnailRenderer.thumbnail[0].url : playlist.thumbnails[0].url,
channelName,
channelId,
playlistId: playlist.id,

View File

@ -88,6 +88,7 @@ export default defineComponent({
title: result.info.title,
description: result.info.description ?? '',
firstVideoId: result.items[0].id,
playlistThumbnail: result.info.thumbnails[0].url,
viewCount: extractNumberFromString(result.info.views),
videoCount: extractNumberFromString(result.info.total_items),
lastUpdated: result.info.last_updated ?? '',

View File

@ -8585,10 +8585,10 @@ yocto-queue@^0.1.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
youtubei.js@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/youtubei.js/-/youtubei.js-5.1.0.tgz#a71474f23fbf8679c1f517f3f8a33064e898683e"
integrity sha512-Rbe71rqqSVGj2kBv7FeIDbod+AEcd84F/7inSLWjt6jv8tmTGLjXr8cjlqzY5WhpNKMJuSUVKLFgCb3V0SHTUA==
youtubei.js@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/youtubei.js/-/youtubei.js-5.2.0.tgz#97e66de34072c40e04e7cf5172c0cf3a1eeccbf7"
integrity sha512-UXbkHnLp+YUSbA6ye58knH11RRx52BWpO/k6wSKQTm6eC/MSUBQO4KdYrO1INptlbOWWn7DjW5LwLMZ6e4qdMw==
dependencies:
jintr "^1.0.0"
linkedom "^0.14.12"