Skip to content

Instantly share code, notes, and snippets.

@SammysHP
Created July 10, 2016 12:40
Show Gist options
  • Save SammysHP/f64aa60b532b3614a953c05b4cf2d3b4 to your computer and use it in GitHub Desktop.
Save SammysHP/f64aa60b532b3614a953c05b4cf2d3b4 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Flac it! Downloader
// @namespace www.sammyshp.de
// @description Download from Flac it!
// @include http://www.flacit.com/album/*
// @include http://flacit.com/album/*
// @include https://www.flacit.com/album/*
// @include https://flacit.com/album/*
// @version 1
// @grant none
// ==/UserScript==
// Optional: Include our jQuery. Flac it! uses 1.x
// require https://code.jquery.com/jquery-3.1.0.min.js
// Example download URL, song is the file in the original download archive, starting with 1:
// http://flacit.com/Store/player.php?id=202928&sid=b53645be0ee5b9ceed47b8f9e0406cc5&song=1
let container = $('<div style="border: 1px solid black; margin: 2em; padding: 0.5em;"></div>').insertBefore('#mp3s');
let baseurl = $('#song > source').first().attr('src').match(/(.*song=)/)[1];
let songcount = 0;
$('.html5player').filter(function (index) {
let title = $(this).parent().attr('title');
return !/^Disk/.test(title);
}).each(function (index) {
// let song = parseInt($(this).attr('onclick').match(/(\d+)/)[1]) + 1;
let song = index + 1;
let title = $(this).parent().attr('title');
container.append('<a href="' + baseurl + song + '">' + title + '</a><br>');
songcount++
});
let shellcommand = $('<br><br><input type="text" readonly style="display: block; width: 100%; box-sizing: border-box;">').appendTo(container);
shellcommand.val('for i in {1..' + songcount + '}; do curl -J -O "' + baseurl + '$i"; done;');
shellcommand.focus(function() { $(this).select(); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment