Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump youtubei.js from 11.0.1 to 12.0.0 #6323

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
38 changes: 9 additions & 29 deletions src/renderer/helpers/api/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand All @@ -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,
Expand All @@ -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
}

/**
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Loading