Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -73,7 +73,7 @@
"vue-observe-visibility": "^1.0.0",
"vue-router": "^3.6.5",
"vuex": "^3.6.2",
"youtubei.js": "^13.4.0"
"youtubei.js": "^15.0.0"
},
"devDependencies": {
"@babel/core": "^7.28.0",
Expand Down
15 changes: 5 additions & 10 deletions src/renderer/helpers/api/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function createInnertube({ withPlayer = false, location = undefined, safet
// This setting is enabled by default and results in YouTube.js reusing the same session across different Innertube instances.
// That behavior is highly undesirable for FreeTube, as we want to create a new session every time to limit tracking.
enable_session_cache: false,
retrieve_innertube_config: false,
retrieve_innertube_config: !generateSessionLocally,
user_agent: navigator.userAgent,

retrieve_player: !!withPlayer,
Expand Down Expand Up @@ -213,7 +213,6 @@ export async function getLocalVideoInfo(id) {
JSON.stringify(webInnertube.session.context)
))

webInnertube.session.po_token = contentPoToken
webInnertube.session.player.po_token = sessionPoToken
} catch (error) {
console.error('Local API, poToken generation failed', error)
Expand All @@ -223,10 +222,10 @@ export async function getLocalVideoInfo(id) {

let clientName = webInnertube.session.context.client.clientName

const info = await webInnertube.getInfo(id)
const info = await webInnertube.getInfo(id, { po_token: contentPoToken })

// temporary workaround for SABR-only responses
const mwebInfo = await webInnertube.getBasicInfo(id, 'MWEB')
const mwebInfo = await webInnertube.getBasicInfo(id, { client: 'MWEB', po_token: contentPoToken })

if (mwebInfo.playability_status.status === 'OK' && mwebInfo.streaming_data) {
info.playability_status = mwebInfo.playability_status
Expand All @@ -246,16 +245,12 @@ export async function getLocalVideoInfo(id) {
const webEmbeddedInnertube = await createInnertube({ clientType: ClientType.WEB_EMBEDDED })
webEmbeddedInnertube.session.context.client.visitorData = webInnertube.session.context.client.visitorData

if (contentPoToken) {
webEmbeddedInnertube.session.po_token = contentPoToken
}

const videoId = hasTrailer && trailerIsAgeRestricted ? info.playability_status.error_screen.video_id : id

// getBasicInfo needs the signature timestamp (sts) from inside the player
webEmbeddedInnertube.session.player = webInnertube.session.player

const bypassedInfo = await webEmbeddedInnertube.getBasicInfo(videoId, 'WEB_EMBEDDED')
const bypassedInfo = await webEmbeddedInnertube.getBasicInfo(videoId, { client: 'WEB_EMBEDDED', po_token: contentPoToken })

if (bypassedInfo.playability_status.status === 'OK' && bypassedInfo.streaming_data) {
info.playability_status = bypassedInfo.playability_status
Expand Down Expand Up @@ -1284,7 +1279,7 @@ function parseLockupView(lockupView, channelId = undefined, channelName = undefi

let viewCount = null

const viewsText = lockupView.metadata.metadata?.metadata_rows[1].metadata_parts?.[0].text?.text
const viewsText = lockupView.metadata.metadata?.metadata_rows[1]?.metadata_parts?.[0].text?.text

if (viewsText) {
const views = parseLocalSubscriberCount(viewsText)
Expand Down
25 changes: 9 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1095,11 +1095,6 @@
"@eslint/core" "^0.14.0"
levn "^0.4.1"

"@fastify/busboy@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.0.0.tgz#f22824caff3ae506b18207bad4126dbc6ccdb6b8"
integrity sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==

"@fortawesome/fontawesome-common-types@6.7.2":
version "6.7.2"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.7.2.tgz#7123d74b0c1e726794aed1184795dbce12186470"
Expand Down Expand Up @@ -8526,12 +8521,10 @@ undici-types@~6.20.0:
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==

undici@^5.19.1:
version "5.29.0"
resolved "https://registry.yarnpkg.com/undici/-/undici-5.29.0.tgz#419595449ae3f2cdcba3580a2e8903399bd1f5a3"
integrity sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==
dependencies:
"@fastify/busboy" "^2.0.0"
undici@^6.21.3:
version "6.21.3"
resolved "https://registry.yarnpkg.com/undici/-/undici-6.21.3.tgz#185752ad92c3d0efe7a7d1f6854a50f83b552d7a"
integrity sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==

unicode-canonical-property-names-ecmascript@^2.0.0:
version "2.0.0"
Expand Down Expand Up @@ -9116,12 +9109,12 @@ 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@^13.4.0:
version "13.4.0"
resolved "https://registry.yarnpkg.com/youtubei.js/-/youtubei.js-13.4.0.tgz#1f52d7ed0ccabd5ba718eede84771aa32683d9e2"
integrity sha512-+fmIZU/dWAjsROONrASy1REwVpy6umAPVuoNLr/4iNmZXl84LyBef0n3hrd1Vn9035EuINToGyQcBmifwUEemA==
youtubei.js@^15.0.0:
version "15.0.0"
resolved "https://registry.yarnpkg.com/youtubei.js/-/youtubei.js-15.0.0.tgz#c5ca88c6a1a289846aca2f7ce7147fce1316b40b"
integrity sha512-giPZREn+q0z8Jr45NUcJUXE7QA2+UD2jx5FR+ULdnexvtHg5uQZr9Am8aYcECPKzbBNe6ksBD1yT4SKNbhpRqA==
dependencies:
"@bufbuild/protobuf" "^2.0.0"
jintr "^3.3.1"
tslib "^2.5.0"
undici "^5.19.1"
undici "^6.21.3"