userscripts/zippyshare.js

32 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

// ==UserScript==
// @name Zippyshare
2015-10-02 16:18:54 +02:00
// @description Zippyshare download URL to Wget command
// @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
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @match http://*.zippyshare.com/*
// @grant none
// ==/UserScript==
AdiUserscriptLib.addButton('Wget Cmd', function () {
var vars = {}
2015-10-14 16:07:36 +02:00
var commandline = 'wget -cO "{name}" --header="Cookie: JSESSIONID={sessioncookie}" {url}\ntouch -d "{date}" "{name}"\n'
var commands = ''
vars.name = $('font:contains("Name: ") + font').text()
vars.url = $('a#dlbutton')[0].href
vars.date = $('font:contains("Uploaded:") + font').text()
2015-10-14 14:27:12 +02:00
vars.sessioncookie = prompt('Session Cookie (is HttpOnly)?')
// Fix date
var datematch = vars.date.match(/^(\d{2})-(\d{2})-(\d{4})(.+)/)
vars.date = AdiUserscriptLib.interpolate('{3}-{2}-{1}{4}', datematch)
2015-10-14 16:07:36 +02:00
commands += AdiUserscriptLib.interpolate(commandline, vars)
var w = window.open();
w.document.write('<pre>' + commands + '</pre>')
w.document.close()
})