carceneaux / alfred-youtube-music-control Goto Github PK
View Code? Open in Web Editor NEWControls music playback in an open Youtube Music tab in Chrome.
License: MIT License
Controls music playback in an open Youtube Music tab in Chrome.
License: MIT License
how would i control the volume of the player?
testet something like this (but it's not working yet):
on alfred_script(q)
tell application "Google Chrome"
set allWins to every window
set allTabs to {}
repeat with currWin in allWins
set allTabs to allTabs & every tab of currWin
end repeat
repeat with currTab in allTabs
try
if (title of currTab) contains "Youtube Music" then set musicTab to currTab
end try
end repeat
tell musicTab to execute javascript "(document.querySelector('[aria-label=\"Decrease volume\"]')).click();"
end tell
end alfred_script
Recently the Previous & Next functions (shortkey and ym..next and ym..previous) no longer worked. As Google recently changed the aria-label
for Previous and Next buttons on the web player.
Make script changes to Previous and Next:
Thanks @carceneaux for creating this plugin. It's fantastic! ๐ธ
i also did some changes to "ym search" i wanted to share. like for other commands the script looks for an existing tab with music.youtube.com open, if it finds one the query is passed to that already open tab, if it does not it opens a new tab with the query.
on alfred_script(q)
set query to q
set musicTab to false
tell application "Brave Browser"
set allWins to every window
set allTabs to {}
repeat with currWin in allWins
set allTabs to allTabs & every tab of currWin
end repeat
repeat with currTab in allTabs
try
if (title of currTab) contains "Youtube Music" then set musicTab to currTab
end try
end repeat
if musicTab = false then
tell application "Brave Browser" to open location "https://music.youtube.com/search?q=" & query
else
set URL of musicTab to "https://music.youtube.com/search?q=" & query
end if
end tell
end alfred_script
thanx for adding the volume-feature.
did some adjustments in order to control the volume with hotkeys to increase and decrease it by "20".
cheers
bendsch
on alfred_script(q)
tell application "Brave Browser"
set allWins to every window
set allTabs to {}
repeat with currWin in allWins
set allTabs to allTabs & every tab of currWin
end repeat
repeat with currTab in allTabs
try
if (title of currTab) contains "Youtube Music" then set musicTab to currTab
end try
end repeat
tell musicTab
set vol to execute javascript "(document.querySelector('[aria-label=\"Volume\"]')).getAttribute('value');"
set vol to vol + 20
execute javascript "(document.querySelector('[aria-label=\"Volume\"]')).setAttribute('value', " & vol & ");"
end tell
end tell
end alfred_script
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.