Skip to content

Instantly share code, notes, and snippets.

@rocktronica
Created January 28, 2012 22:26
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 rocktronica/1696006 to your computer and use it in GitHub Desktop.
Save rocktronica/1696006 to your computer and use it in GitHub Desktop.
Scraping PMs off the SETV forums
if (!$) { throw "Please jQuerify."; }
var iStart = 180, sName = "Case-Sensitive Name";
var w = window.open();
var $output = $(w.document).find("body").css({
"width": "600px",
"margin": "20px auto",
"font-family": "Sans-Serif"
});
function getNext(iStartOffset) {
console.log("Requesting ", iStartOffset);
$.get("http://www.somethingelsetv.net/forum/index.php?action=pm;f=inbox;sort=date;start=" + iStartOffset, function(resp){
console.log(" Appending ", iStartOffset);
var $newDivs = $(resp).find("div[class^='window']");
$output.prepend($newDivs);
if (iStart > 0) {
iStart -= 15;
getNext(iStart);
}
});
}
getNext(iStart);
// cleanup
$output.find("> div").each(function() {
$div = $(this);
if ($div.find("h4").text().trim() !== sName) { $div.remove(); }
});
$output.find("ul.smalltext").remove();
$output.find(".signature").remove();
$output.find("img").remove();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment