🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

YouTube Helper API

YouTube Helper API.

These are versions of this script where the code was updated. Show all versions.

  • v0.9.4 05.12.2025

    Added a 5th logging level.

  • v0.9.3.3 05.12.2025

    Tweaked logging level for a few messages.

  • v0.9.3.2 05.12.2025

    fix typo

  • v0.9.3.1 05.12.2025

    fix typo

  • v0.9.3 05.12.2025

    New Debug System: Added api.debug with 4 logging levels (minimal, typical, detailed, all). Logs point to the caller's line number.
    New Helpers: Added reloadToCurrentProgress() and exposed gmCapabilities.
    Internal Improvements: Library now uses the new debug system for cleaner console output and better error handling.

  • v0.9.2 01.12.2025

    Moved 'use strict' to global scope.
    Added added a shim for Greasemonkey API functions. This should catch missing GM or permission not granted errors without crashing.

  • v0.9.1 20.11.2025

    Fixed video playback language updates not being detected correctly.

  • v0.9.1 20.11.2025

    Update comments and logging.

  • v0.9.0 20.11.2025

    Switched to an isolated library pattern.

  • v0.8.0 19.11.2025

    Updated to be a global singleton. (again)
    Updated to inject into the newer/broader globalThis instead of window.

  • v0.7.6 18.11.2025

    Made language track detection more robust.
    Added logic to determine if the video is auto dubbed with its own appState value.

  • v0.7.5 14.11.2025

    Updated API logic to match YouTube's new audio track format.

  • v0.7.4 14.11.2025

    Fixed an issue that caused the script to notify itself being ready before the data has finished populating.

  • v0.7.3 14.11.2025

    Fixed a bug that caused the script process videos before all video data has loaded into the video player.

  • v0.7.2 09.11.2025

    Fixed a bug that caused the video html element to become stale after reloading throw YouTube's API. This seems to be new YouTube behavior introduced by the New Delhi (2025) UI update.

  • v0.7.1 08.11.2025

    Fixed a race condition where ad states and video states can update in random order depending on loading conditions.

  • v0.7.0 04.11.2025

    Fixed a bug that caused player updates to be handled event when video data does not exist.
    Fixed a race condition bug that caused the API to return incorrect data.

  • v0.6.2.1 04.11.2025

    fix type

  • v0.6.2 04.11.2025

    Excluded certain urls from being early processed.

  • v0.6.1 26.10.2025

    Updated to track if the current video has been streamed or premiered. (basically any format that could have a chat log would return true)

  • v0.6.0 25.10.2025

    Updated the API to directly reference read-only proxy objects for better performance.
    Updated page type to use the current page URL as fallback when YouTube's native API fails to return a proper response.

  • v0.5.8 17.10.2025

    Updated how the player api fallback working when running in iframes.
    Updated the listener player update event.

  • v0.5.7 01.10.2025
    New
    • Refactored storageApi to use a declarative lookup table, making it more readable and easier to extend.
    • Converted dynamic DOM element properties on the page object to use getters, ensuring references are always current on a Single Page Application.
    • Consolidated reloadVideo functions to remove duplicated code and follow the DRY principle.
    • Adopted underscore (_) prefix as a naming convention for internal functions to clearly separate them from the public API.
    • Added a console warning if a non-existent YouTube function was called through the API proxy instead of failing silently.
    Fixes
    • Fixed a bug that caused duplicate timeupdate event listeners to be added repeatedly by tracking listener attachment in a WeakMap.
    • Corrected storage functions to consistently use the storageApi abstraction instead of calling GM functions directly.
  • v0.5.6 01.10.2025

    Added a fuction to reload the current video.

  • v0.5.5 01.10.2025

    Added distinction between content that is live or was live (VOD), and content that is currently live exclusively.

  • v0.5.4 29.09.2025

    Added a private event target so we don't fire event into the document directly. Global event handshake may eventually be added.

  • v0.5.3 29.09.2025

    Use a singleton pattern for initiation to avoid duplicate events firing.

  • v0.5.2 29.09.2025

    Fixed tracked playback progress not updating when loading a new video.

  • v0.5.1 29.09.2025

    Updated all public storage functions to eager sync between script storage and local storage.
    Updated page type updating to listen for different events. Should now update earlier and more consistently.
    Fix time specified video detection. YouTube player response object turns out to be unreliable for this.

  • v0.5.0 29.09.2025

    No longer exposing storageApi.
    Added public delete and list functions for synced storage.

  • v0.4.8 29.09.2025

    Added support for time specified video detection.
    Added support for playlist id detection.
    Exposed storagedApi to publicApi.

  • v0.4.7 29.09.2025

    Fixed ad detection and tracking.

  • v0.4.6 29.09.2025

    Updated player selector for mobile.

  • v0.4.5 28.09.2025

    Updated how premium bitrate options are determined.

  • v0.4.4 27.09.2025

    minor update. no functional change.

  • v0.4.3 27.09.2025

    Updated saving and loading logic to try to use both GM and localStorage in parallel.

  • v0.4.2 27.09.2025

    Let consumer scripts to grant handling.

  • v0.4.1 27.09.2025

    minor bug fix.

  • v0.4.0 27.09.2025

    Testing if GM functions can be extracted to a helper api.

  • v0.3.0 22.09.2025

    Implemented a custom video playback progress tracking function that avoids tracking ad playback progresses.
    Implemented a custom ad state tracking function.
    Implemented a custom function to reload the current playing video to the current tracked playback progress. Removed inline comments. Code is just updating too much to maintain comments at this point.

  • v0.2.1 21.09.2025

    -

  • v0.2.0 21.09.2025

    Added inline documentations.
    Added save/load functions for settings.

  • v0.1.2 21.09.2025

    Delay initial player update check with the pageshow event listener.

  • v0.1.1 21.09.2025
  • v0.1.0 21.09.2025

    Added a proxy for YouTube's API

  • v0.0.9 20.09.2025

    -

  • v0.0.9 20.09.2025

    Changed page type finding logic. Could be reverted.

  • v0.0.8.3 20.09.2025
  • v0.0.8.3 20.09.2025

    test loading order.

  • v0.0.8.1 20.09.2025

Show all script versions