Feat: Implement Smart Speed feature using YouTube heatmap (#1463)#3599
Merged
ImprovedTube merged 2 commits intocode-charity:masterfrom Feb 6, 2026
Merged
Conversation
Member
|
Awesome!!! ( added the shortcut GUI element. )
|
Contributor
Author
|
No worries at all! I expected a bit of legacy structure given the project's history, but it was honestly a fun challenge to figure out how everything fits together. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request implements the "Smart Speed" feature requested in Issue #1463. This functionality leverages YouTube's native "Most Replayed" heatmap data (engagement histogram) to dynamically adjust playback speed in real-time, optimizing content consumption efficiency.
The feature analyzes normalized engagement metrics to automatically:
Key Changes:
player.js):ImprovedTube.heatmapmodule to encapsulate state and logic.getPlayerResponse().ytInitialData,ytInitialPlayerResponse).fetchof the document source to parse raw JSON when runtime data is unavailable or obfuscated (common in music videos or specific user sessions).Recursive Parsing: Implemented a recursive search algorithm to locate
MARKER_TYPE_HEATMAPobjects within arbitrary JSON structures, making the feature robust against minor DOM layout changes.Dynamic Speed Mapping: Implemented a heuristic gradient for speed adjustment based on intensity scores:
Score ≤ 0.05: 2.00x
Score ≤ 0.12: 1.75x
Score ≤ 0.18: 1.50x
Score ≤ 0.25: 1.25x
Score > 0.25: 1.00x
User Interface (
menu/skeleton-parts/player.js):Added a toggle switch in the "Player" section labeled "Smart Speed (Skip Boring Parts)".
Shortcuts (
shortcuts.js):Added logic for a keyboard shortcut to toggle the feature state during playback.
Localization (
messages.json):Added the English locale string for the new menu item.
Technical Implementation Details:
try/catchblocks and type checking prevent player instability if upstream API data formats change.yt-navigate-finishto ensure correct re-initialization during YouTube's Single Page Application navigation events.How to Test:
Related Issue:
Closes #1463