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

Support YouTube using PageHeader on user channels not just auto-generated ones #4543

Merged

Conversation

absidue
Copy link
Member

@absidue absidue commented Jan 14, 2024

Support YouTube using PageHeader on user channels not just auto-generated ones

Pull Request Type

  • Bugfix
  • Feature Implementation

Related issues

closes #4560

Description

This pull request fixes the TypeError: Cannot read properties of undefined (reading 'name') error messages that you may have seen poping up on the subscriptions page and on the channel pages. There are other places in FreeTube that make requests to the channel page, however I decided not to change anything there yet, as that would cause conflicts with #4340.

YouTube has an A/B test going on to use the PageHeader node on user channels, previously it was only used on system channels like @gaming. This pull request adds support for that to FreeTube.

Screenshots

error-message

Testing

In src/renderer/helpers/api/local.js add visitor_data: 'CgtwUmJqXzhJdVFCSijM_oStBg%3D%3D', to the InnerTube.create call in the createInnertube function e.g. between line 46 and 47.

Test various user channels e.g. https://youtube.com/@YouTube and then also the system ones https://youtube.com/@gaming and https://youtube.com/@live to make sure that the new logic didn't break them (they are empty apart from the header, the banner being missing is expected too as they don't have one on YouTube).

--- a/src/renderer/helpers/api/local.js
+++ b/src/renderer/helpers/api/local.js
@@ -44,6 +44,7 @@ async function createInnertube(options = { withPlayer: false, location: undefine
 
   return await Innertube.create({
     retrieve_player: !!options.withPlayer,
+    visitor_data: 'CgtwUmJqXzhJdVFCSijM_oStBg%3D%3D',
     location: options.location,
     enable_safety_mode: !!options.safetyMode,
     client_type: options.clientType,

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 0.19.1

@@ -1,5 +1,8 @@
{
"vueCompilerOptions": {
"target": 2.7
},
"compilerOptions": {
"strictNullChecks": true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes vscode actually show undefined and null in type definitions e.g. auto-complete and the popup that appears when you hover over functions.

@absidue absidue marked this pull request as ready for review January 29, 2024 17:51
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) January 29, 2024 17:51
@github-actions github-actions bot added PR: dependencies Pull requests that update a dependency file PR: waiting for review For PRs that are complete, tested, and ready for review labels Jan 29, 2024
@PikachuEXE
Copy link
Collaborator

Got conflict but bot not announcing?

@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jan 30, 2024
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@efb4f5ff-1298-471a-8973-3d47447115dc

is it possible to provide a build so i can daily drive this for a day or two

Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@absidue absidue added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jan 30, 2024
@PikachuEXE
Copy link
Collaborator

@efb4f5ff-1298-471a-8973-3d47447115dc
https://github.com/PikachuEXE/FreeTube/actions/runs/7719513038
Only got dev & this PR

@curather

This comment was marked as off-topic.

@PikachuEXE

This comment was marked as off-topic.

@PikachuEXE

This comment was marked as off-topic.

@absidue

This comment was marked as off-topic.

@curather

This comment was marked as off-topic.

@absidue
Copy link
Member Author

absidue commented Jan 31, 2024

@curather That's just a placebo, YouTube randomly returns the empty feed. This pull request has no change that affects the watch page, even the YouTube.js upgrade doesn't affect it.
Anyway that issue is off-topic for this pull request.

PikachuEXE
PikachuEXE previously approved these changes Feb 1, 2024
package.json Outdated Show resolved Hide resolved
@FreeTubeBot FreeTubeBot merged commit 30248d6 into FreeTubeApp:development Feb 9, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Feb 9, 2024
@absidue absidue deleted the user-channel-page-header branch February 9, 2024 16:45
absidue added a commit that referenced this pull request Feb 23, 2024
…ated ones (#4543)

* Support YouTube using PageHeader on user channels not just auto-generated ones

* Bump YouTube.js to 9.0.2 as requested
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Refreshing home page creates error
6 participants