Jump to content

Youtube Music Controls for Chrome


Recommended Posts

Alfred Workflow: Youtube Music Controls for Chrome

Latest version: download here

GitHub: https://github.com/carceneaux/alfred-youtube-music-control

An Alfred workflow for controlling Youtube Music playback in an open Youtube Music tab in Chrome.

I built this workflow out of necessity as Google Play music will be retired shortly.I listen to music
most of the day at work and this helps immensely.

The workflow uses the following keywords to control playback in an open Youtube Music tab:

* 'ym': Play/Pause
* 'ym prev': Previous Song
* 'ym next': Next Song
* 'ym+': Thumbs Up Song
* 'ym-': Thumbs Down Song
* 'ym vol <volume percentage>': Set Youtube Music Volume
* 'ym search <search term>': Search Youtube Music
* 'ym shuffle': Shuffle Playlist
* 'ym repeat': Set Repeat Setting
* 'ym quit': Close Youtube Music Tab

Requirements

By default, executing JavaScript through AppleScript is turned off in Chrome. To turn it on, from the menu
bar, go to View > Developer > Allow JavaScript from Apple Events.

For more information: https://support.google.com/chrome/?p=applescript

 

 

screenshot.png

Edited by chris_arceneaux
updating post for latest release
Link to post
12 hours ago, chris_arceneaux said:

While this workflow was created using Alfred 4, it should also work with Alfred 2 & 3.


It won’t. A Workflow created or edited in an Alfred version can’t be opened by previous versions.

Link to post

It seems that doesn't work.

I've left my error log.

(Error log of `ym next`)

 

ERROR: Youtube Music Chrome Controls[Run NSAppleScript] {

    NSAppleScriptErrorAppName = "Google Chrome";

    NSAppleScriptErrorBriefMessage = "AppleScript\Ub97c \Ud1b5\Ud55c \Uc790\Ubc14\Uc2a4\Ud06c\Ub9bd\Ud2b8 \Uc2e4\Ud589 \Uae30\Ub2a5\Uc774 \Uaebc\Uc838 \Uc788\Uc2b5\Ub2c8\Ub2e4. \Uc774 \Uae30\Ub2a5\Uc744 \Uc0ac\Uc6a9\Ud558\Ub3c4\Ub85d \Uc124\Uc815\Ud558\Ub824\Uba74 \Uba54\Ub274 \Ubc14\Uc5d0\Uc11c \Ubcf4\Uae30 > \Uac1c\Ubc1c\Uc790 > Apple Events\Uc758 \Uc790\Ubc14\Uc2a4\Ud06c\Ub9bd\Ud2b8 \Ud5c8\Uc6a9\Uc73c\Ub85c \Uc774\Ub3d9\Ud558\Uc138\Uc694. \Uc790\Uc138\Ud55c \Ub0b4\Uc6a9\Uc740 \Ub2e4\Uc74c \Ud398\Uc774\Uc9c0\Uc5d0\Uc11c \Ud655\Uc778\Ud558\Uc138\Uc694. https://support.google.com/chrome/?p=applescript";

    NSAppleScriptErrorMessage = "Google Chrome got an error: AppleScript\Ub97c \Ud1b5\Ud55c \Uc790\Ubc14\Uc2a4\Ud06c\Ub9bd\Ud2b8 \Uc2e4\Ud589 \Uae30\Ub2a5\Uc774 \Uaebc\Uc838 \Uc788\Uc2b5\Ub2c8\Ub2e4. \Uc774 \Uae30\Ub2a5\Uc744 \Uc0ac\Uc6a9\Ud558\Ub3c4\Ub85d \Uc124\Uc815\Ud558\Ub824\Uba74 \Uba54\Ub274 \Ubc14\Uc5d0\Uc11c \Ubcf4\Uae30 > \Uac1c\Ubc1c\Uc790 > Apple Events\Uc758 \Uc790\Ubc14\Uc2a4\Ud06c\Ub9bd\Ud2b8 \Ud5c8\Uc6a9\Uc73c\Ub85c \Uc774\Ub3d9\Ud558\Uc138\Uc694. \Uc790\Uc138\Ud55c \Ub0b4\Uc6a9\Uc740 \Ub2e4\Uc74c \Ud398\Uc774\Uc9c0\Uc5d0\Uc11c \Ud655\Uc778\Ud558\Uc138\Uc694. https://support.google.com/chrome/?p=applescript";

    NSAppleScriptErrorNumber = 12;

    NSAppleScriptErrorRange = "NSRange: {382, 84}";

}

Link to post

From the Alfred debug console: 

 

Quote

 

[05:19:44.699] Youtube Music Chrome Controls[Keyword] Processing complete

[05:19:44.704] Youtube Music Chrome Controls[Keyword] Passing output '' to Run NSAppleScript

[05:19:44.748] ERROR: Youtube Music Chrome Controls[Run NSAppleScript] {

    NSAppleScriptErrorBriefMessage = "The variable musicTab is not defined.";

    NSAppleScriptErrorMessage = "The variable musicTab is not defined.";

    NSAppleScriptErrorNumber = "-2753";

    NSAppleScriptErrorRange = "NSRange: {350, 8}";

}

 

 

Link to post

New version has been released with the following enhancements:

  • Improved volume setting
    • Current volume is shown in Alfred results
  • Repeat control added
    • Current repeat setting is shown in Alfred results
  • Shuffle playlist control added
    • Unlike Youtube Music button, this also forces a new song to be played
  • Improved Like/Dislike setting
    • Fix ensures that current song playing is liked/disliked

Download Latest Workflow Here

alfred-repeat.jpg

alfred-volume.jpg

Link to post
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...