Support YouTube using PageHeader on user channels not just auto-generated ones
Support YouTube using PageHeader on user channels not just auto-generated ones
Pull Request Type
- [x] Bugfix
- [x] Feature Implementation
Related issues
closes #4560
Description
This is in draft status as it depends on the following YouTube.js pull requests: https://github.com/LuanRT/YouTube.js/pull/577, https://github.com/LuanRT/YouTube.js/pull/581, https://github.com/LuanRT/YouTube.js/pull/582, https://github.com/LuanRT/YouTube.js/pull/583 and https://github.com/LuanRT/YouTube.js/pull/584
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 https://github.com/FreeTubeApp/FreeTube/pull/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
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