js tumblr dashboard parser
photoはパス。
HTML変わると思うとやる気でない
var extractor = { quote: function (context) { var q = $x(".//div[@class='post_info']/following-sibling::node()[following-sibling::div[not(contains(@style,'none'))]]", context).map ( function (e) { if( e.nodeType == e.TEXT_NODE ) return e.nodeValue.replace(/^\s*/, "").replace(/\s*$/, "").replace(/[“”]/g, ""); else return e.innerHTML; } ).join(""); var source = $x(".//div[@class='post_info']/following-sibling::div[following-sibling::div]", context).map ( function (n) { return n.innerHTML.replace(/\s{2,}/g, "") } ); return { quote: q, source: source, } }, link: function (context) { var a = $x(".//div[@class='post_info']/following-sibling::div[1]/a", context).pop(); return { name: a.textContent, url: a.getAttribute("href"), desc: $x(".//div[@class='post_info']/following-sibling::div[2]", context).pop().innerHTML, } }, regular: function (context) { var titleElement = $x(".//div[@class='post_info']/following-sibling::div[following-sibling::div[@id]]", context).pop(); var title = ""; if ( titleElement ) { title = titleElement.textContent.replace(/^\s*/, "").replace(/\s*$/, ""); context = titleElement; } else { context = $x(".//div[@class='post_info']", context).pop(); } var desc = $x("./following-sibling::node()[following-sibling::div[@id]]", context).map ( function (e) { if( e.nodeType == e.TEXT_NODE ) return e.nodeValue.replace(/^\s*/, "").replace(/\s*$/, "").replace(/[“”]/g, ""); else return e.innerHTML; } ).join(""); return { title: title, desc: desc }; }, photo: function (context) { } } $x("id('posts')/li[@id]").map ( function (n) { var c = n.className; // c = c.replace(/\bpost|is_reblog|not_mine|same_user_as_last|is_mine\b/g, ""); // c = c.replace(/^\s*/, "").replace(/\s*$/, ""); if ( c.match(/\bquote\b/) ) { return extractor.quote(n); } else if ( c.match(/\bphoto\b/) ) { return extractor.photo(n); } else if ( c.match(/\blink\b/) ) { return extractor.link(n); } else if ( c.match(/\bregular\b/) ) { return extractor.regular(n); } return c; } );