Skip to content

Instantly share code, notes, and snippets.

@kurumigi
Created September 16, 2009 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurumigi/187910 to your computer and use it in GitHub Desktop.
Save kurumigi/187910 to your computer and use it in GitHub Desktop.
[GM script]yam Downloader
// ==UserScript==
// @name yam Downloader
// @namespace http://d.hatena.ne.jp/kurumigi/
// @description Download flv or mp3 files from http://mymedia.yam.com/
// @include http://mymedia.yam.com/m/*
// ==/UserScript==
(function () {
GM_xmlhttpRequest({
method: "GET",
url: location.href.replace("http://mymedia.yam.com/m/","http://mymedia.yam.com/api/a/?pID="),
onload: function (httpObj) {
if (httpObj.responseText.match(/(furl|mp3file)=(http:\/\/.*?\.(mp3|flv))(&|$)/)) {
var title = document.evaluate("//h1[@class='heading']/span[1]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
title.singleNodeValue.innerHTML = '<a href="' + RegExp.$2 + '">' + title.singleNodeValue.innerHTML + '</a>';
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment