This is a lightweight utility that allows you to inject a download button into web pages that Ritashugisha's Luxinate (backed by youtubedl) is capable of downloading audio from (e.g. youtube, soundcloud, bandcamp...).
Luxinate is an awesome plugin for Alfred 2 that allows you to download Audio and Video (using youtube-dl) from a variety of sites, by simply providing a link to the page.
This utility extends Luxinate's capabilities into the browser with two parts:
- a simple web-api hosted locally to call Luxinate and begin song downloads
- a set of scripts to inject into pages that insert download buttons which call the web-api
WARNING: This is massively insecure, hacky, and overcomplicated, proceed at your own risk. The same thing can be accomplished with many simpler chrome extensions, or by simply using youtube-dl directly. I chose the hard way because I like Lux's interface and interaction with Alfred.
This assumes that you're already comfortable with the command line, and that you are already running a webserver with php enabled on your mac.
git clone https://github.com/pirate/inject-luxinate
ln -s inject-luxinate /Library/WebServer/Documents/lux
nano inject-luxinate/luxinate/_config.xml
# change this line to your actual preffered download directory, then save and close
<download_dir default="/Users/nick/Downloads/">/Users/nick/Desktop/</download_dir>
sudo visudo
# insert the following line at the bottom (with the correct path), then save and close
_www ALL=NOPASSWD: /path/to/inject-luxinate/download.py
That will allow you to call Luxinate using a URL from your browser. After doing this step, opening http://localhost/lux/lux.php?url=(...) should begin to download the Nyan Cat song to the download_dir location set in luxinate/_config.xml
.
Now for part two, getting the download buttons injected:
- Install the Chrome extension Injector in order to inject css and js into pages (there are many equivalents for Firefox, Safari, and other browsers).
- Go to the Injector settings page by clicking on the syringe icon by the address bar.
- Add three new entries as follows:
- domain: soundcloud.com
type: CSS
content: copy paste in everything from inject-lux-soundcloud.css
- domain: soundcloud.com
type: JS
content: copy paste in everything from inject-lux-soundcloud.js
- domain: youtube.com
type: JS
content: copy paste in everything from inject-lux-youtube.js
You should now be able to visit your Soundcloud Stream and see little triangle icons labelled "∆ Lux" next to every song. Clicking on that icon will download the song. Give it a shot!
For Youtube you can find the "∆" Luxinate button next to the thumbs-up and thumbs-down under the video.