diff --git a/package.json b/package.json index 0f56574e21736..5b9e16c32d6dd 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "vue-observe-visibility": "^1.0.0", "vue-router": "^3.6.5", "vuex": "^3.6.2", - "youtubei.js": "^11.0.1" + "youtubei.js": "^12.0.0" }, "devDependencies": { "@babel/core": "^7.26.0", diff --git a/src/renderer/helpers/api/local.js b/src/renderer/helpers/api/local.js index af83d531b8a55..9b1e3b07ac991 100644 --- a/src/renderer/helpers/api/local.js +++ b/src/renderer/helpers/api/local.js @@ -658,6 +658,8 @@ export function parseLocalChannelHeader(channel, onlyIdNameThumbnail = false) { const image = header.content.image thumbnailUrl = image.avatar?.image[0].url } + } else if (header.content.animated_image) { + thumbnailUrl = header.content.animated_image.image[0].url } if (!thumbnailUrl && channel.metadata.thumbnail) { @@ -1131,7 +1133,7 @@ export function parseLocalListVideo(item) { author: video.author.name, authorId: video.author.id, description: video.description, - viewCount: video.view_count == null ? (video.short_view_count.text == null ? null : parseLocalSubscriberCount(video.short_view_count.text)) : extractNumberFromString(video.view_count.text), + viewCount: video.view_count?.text == null ? (video.short_view_count.text == null ? null : parseLocalSubscriberCount(video.short_view_count.text)) : extractNumberFromString(video.view_count.text), published, lengthSeconds: isNaN(video.duration.seconds) ? '' : video.duration.seconds, liveNow: video.is_live, @@ -1503,7 +1505,7 @@ export function mapLocalLegacyFormat(format) { } /** - * @param {import('youtubei.js').YTNodes.Comment|import('youtubei.js').YTNodes.CommentView} comment + * @param {import('youtubei.js').YTNodes.CommentView} comment * @param {import('youtubei.js').YTNodes.CommentThread} commentThread */ export function parseLocalComment(comment, commentThread = undefined) { @@ -1517,7 +1519,7 @@ export function parseLocalComment(comment, commentThread = undefined) { hasReplyToken = true } - const parsed = { + return { id: comment.comment_id, dataType: 'local', authorLink: comment.author.id, @@ -1534,33 +1536,11 @@ export function parseLocalComment(comment, commentThread = undefined) { replyToken, showReplies: false, replies: [], - - // default values for the properties set below - memberIconUrl: '', - time: '', - likes: 0, - numReplies: 0 - } - - if (comment.type === 'Comment') { - /** @type {import('youtubei.js').YTNodes.Comment} */ - const comment_ = comment - - parsed.memberIconUrl = comment_.is_member ? comment_.sponsor_comment_badge.custom_badge[0].url : '' - parsed.time = getRelativeTimeFromDate(calculatePublishedDate(comment_.published.text.replace('(edited)', '').trim()), false) - parsed.likes = comment_.vote_count - parsed.numReplies = comment_.reply_count - } else { - /** @type {import('youtubei.js').YTNodes.CommentView} */ - const commentView = comment - - parsed.memberIconUrl = commentView.is_member ? commentView.member_badge.url : '' - parsed.time = getRelativeTimeFromDate(calculatePublishedDate(commentView.published_time.replace('(edited)', '').trim()), false) - parsed.likes = commentView.like_count - parsed.numReplies = parseLocalSubscriberCount(commentView.reply_count) + memberIconUrl: comment.is_member ? comment.member_badge.url : '', + time: getRelativeTimeFromDate(calculatePublishedDate(comment.published_time.replace('(edited)', '').trim()), false), + likes: comment.like_count, + numReplies: parseLocalSubscriberCount(comment.reply_count) } - - return parsed } /** diff --git a/yarn.lock b/yarn.lock index dba470f88403a..f237163466167 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5845,10 +5845,10 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jintr@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/jintr/-/jintr-3.0.2.tgz#633ecc8da930d25f5004697acb5af4ff36628f26" - integrity sha512-5g2EBudeJFOopjAX4exAv5OCCW1DgUISfoioCsm1h9Q9HJ41LmnZ6J52PCsqBlQihsmp0VDuxreAVzM7yk5nFA== +jintr@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/jintr/-/jintr-3.1.0.tgz#5d4ec7ba695dfae3cc3f487545939a4ed1ad69b8" + integrity sha512-azhCHApkRfBH8INpiUCwKBYaNCdB5G+x3NApsI2MxQXSlgFAx7rap3YwE3JAkN08GO8f3ilZsGB0Yvc+412ntQ== dependencies: acorn "^8.8.0" @@ -9656,12 +9656,12 @@ yocto-queue@^1.0.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== -youtubei.js@^11.0.1: - version "11.0.1" - resolved "https://registry.yarnpkg.com/youtubei.js/-/youtubei.js-11.0.1.tgz#5729bbf2df8dff58c3555140d23ae83c458f0b34" - integrity sha512-ZsbOd+5XF2Ofi3FrLMfYd+f9g9H8xswlouFhjhOqbwT68dMJtX6CRGsHNj5VTFCR/+L/865x1lnUlllB2dDDTA== +youtubei.js@^12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/youtubei.js/-/youtubei.js-12.0.0.tgz#a36159918bf3e255a052d42afc9ca9c0f8c82a8c" + integrity sha512-pGmVb1I9b2gseqmuMx+BCajzVUi04+r+8zxj4Fk/iQaGQGvBCbY87Tu9mdvEgIQYTkkb4Fza7GZGrH9AjYNbrw== dependencies: "@bufbuild/protobuf" "^2.0.0" - jintr "^3.0.2" + jintr "^3.1.0" tslib "^2.5.0" undici "^5.19.1"