forked from FriedChickenButt/youtube-webos
-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shorts: Remove shorts from Subscriptions tab
- Loading branch information
1 parent
cacdf6c
commit 219c7eb
Showing
5 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* eslint no-redeclare: 0 */ | ||
/* global fetch:writable */ | ||
import { configRead } from './config'; | ||
|
||
const origParse = JSON.parse; | ||
JSON.parse = function () { | ||
const r = origParse.apply(this, arguments); | ||
if (!configRead('removeShorts')) { | ||
return r; | ||
} | ||
|
||
// First page of subscriptions tab | ||
const gridRenderer = | ||
r?.contents?.tvBrowseRenderer?.content?.tvSecondaryNavRenderer?.sections[0] | ||
?.tvSecondaryNavSectionRenderer?.tabs[0]?.tabRenderer?.content | ||
?.tvSurfaceContentRenderer?.content?.gridRenderer; | ||
|
||
if (gridRenderer?.items) { | ||
removeShorts(gridRenderer); | ||
} | ||
|
||
// Pagination | ||
const gridContinuation = r?.continuationContents?.gridContinuation; | ||
if (gridContinuation?.items) { | ||
removeShorts(gridContinuation); | ||
} | ||
|
||
return r; | ||
}; | ||
|
||
function removeShorts(gridRenderer) { | ||
gridRenderer.items = gridRenderer.items.filter( | ||
(elm) => elm?.tileRenderer?.onSelectCommand?.reelWatchEndpoint == null | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters