Skip to content

YouTube Music: Refactor command structure and improve error handling#25370

Merged
raycastbot merged 9 commits into
raycast:mainfrom
hugodemenez:fix/youtube-music
Feb 20, 2026
Merged

YouTube Music: Refactor command structure and improve error handling#25370
raycastbot merged 9 commits into
raycast:mainfrom
hugodemenez:fix/youtube-music

Conversation

@hugodemenez
Copy link
Copy Markdown
Contributor

@hugodemenez hugodemenez commented Feb 12, 2026

Description

Refactors all YouTube Music commands to use a consistent, robust pattern and fixes commands failing with "Unknown Error" when JavaScript from Apple Events is not enabled or no matching tab is found. Also translates leftover German UI strings to English and adds setup documentation.

Fixes #25177

Changes

  • Extract inline JS into exported constants (dislike.tsx, like.tsx, fast-forward.tsx, rewind.tsx, play-pause.tsx, next-track.tsx, previous-track.tsx, next-chapter.tsx, previous-chapter.tsx, remove-like.tsx): All JavaScript snippets that were inlined inside default exports are now standalone exported constants/functions. This improves readability and makes the JS independently testable.
  • Standardize return values to descriptive strings: Every JS snippet now returns a specific string identifier (e.g. "like-clicked", "dislike-not-found", "fast-forward-success") instead of true/false, making result handling unambiguous.
  • Unify result handling with switch statements: All commands now use switch on the result string to display specific HUD feedback per outcome, replacing ad-hoc if/else checks.
  • Move chapter-navigation JS out of utils.ts (next-chapter.tsx, previous-chapter.tsx): The shared goToChapter object is removed; each command now owns its JS with more granular error states ("no-active-chapter", "no-next-chapter", etc.).
  • Improve runJSInYouTubeMusicTab error handling (utils.ts): The function now throws on known error conditions (JS not allowed, no matching tab, JS runtime errors) and shows actionable toasts with a link to setup docs, instead of silently returning false.
  • Translate German strings to English (remove-like.tsx): Replaced leftover German messages ("Kein Like gesetzt", "Fehler beim Entfernen des Likes") with English equivalents.
  • Clean up unused code (utils.ts): Removed the OsaError interface and ErrorMessages type that are no longer needed.
  • Add setup documentation (README.md): Documented how to enable "Allow JavaScript from Apple Events" for Safari, Chrome/Chromium, and WebCatalog apps, with screenshots.

Screencast

fix-yt-music.mp4

Checklist

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: youtube-music Issues related to the youtube-music extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[YouTube Music] Commands not working...

3 participants