userscripts/podomatic.js

28 lines
907 B
JavaScript
Raw Permalink Normal View History

2015-09-30 12:42:46 +02:00
// ==UserScript==
// @name PodOmatic
// @description PodOmatic download URLs to Wget commands
// @version 1.0
// @namespace http://www.adrian.kousz.ch/
2015-10-14 14:27:12 +02:00
// @require https://git.adrian.kousz.ch/adrian/userscripts/raw/master/lib.js
2015-09-30 12:42:46 +02:00
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @match http://*.podomatic.com/*
// @grant none
// ==/UserScript==
AdiUserscriptLib.addButton('Wget Cmds', function () {
var vars = {}
2015-10-14 16:07:36 +02:00
var commandline = 'wget -cO "{name}.mp3" {url}\n'
2015-09-30 12:42:46 +02:00
var commands = ''
$('a.podcast-title').each(function () {
divlinks = $(this).nextUntil('div.links').next()
vars.url = divlinks.find('a:contains("Download")').attr('href')
2015-09-30 12:42:46 +02:00
vars.name = $(this).text()
2015-10-14 16:07:36 +02:00
commands += AdiUserscriptLib.interpolate(commandline, vars)
2015-09-30 12:42:46 +02:00
})
var w = window.open();
w.document.write('<pre>' + commands + '</pre>')
w.document.close()
})