So, I managed to hack together a solution:
Facebook (at the time of writing) loads old messages if you scroll all the way to the top, with the newest messages being kept at the bottom.
I wrote a Greasemonkey script to force the webpage to constantly jump to the top, making Facebook load approximately 6000 messages in about 5-8 minutes. I then copied and pasted everything to a text file, which I can later parse and prettify at my own leisure.
The script is below:
// ==UserScript==
// @name ScrollToTop
// @namespace Deflect
// @description Perpetually scrolls to the top of the screen until disabled.
// @include *
// @version 1
// ==/UserScript==
var amScrolling = false;
var perpetualScroll = function () {
var createLink = function () {
var scrollLink = document.createElement('a');
scrollLink.className = (scrollLink.className || "") + ' topScroll';
scrollLink.style.display = 'block';
scrollLink.style.position = 'fixed';
scrollLink.style.bottom = '1em';
scrollLink.style.right = '1em';
scrollLink.style.color = '#fff';
scrollLink.style.backgroundColor = '#000';
scrollLink.style.padding = '0.5em';
scrollLink.href = '#';
scrollLink.textContent = 'Start Scroll';
scrollLink.onclick = function (e){
amScrolling = !amScrolling;
if (amScrolling) {
scrollLink.style.backgroundColor = '#333';
scrollLink.textContent = 'Stop Scroll';
} else {
scrollLink.style.backgroundColor = '#000';
scrollLink.textContent = 'Start Scroll';
}
return false;
};
return scrollLink;
};
var scrollDiv = document.createElement("div");
scrollDiv.id = "topScroll0x2a";
scrollDiv.appendChild(createLink());
document.body.appendChild(scrollDiv);
var scroll = function () {
if (amScrolling) {
window.scrollTo(0, 0);
}
};
var intervalId = window.setInterval(scroll, 50);
};
perpetualScroll();
However, this isn't an optimal solution because a lot of the work is still manual -- if I want to get the messages of multiple users, I still have to either do them one at a time, or open up multiple tabs or something.
If you wanted to, you could probably modify the script to programmatically detect when it's hit the top of the screen, grab all the messages, prettify it, and slap it onto pastebin or something, but I didn't feel like doing all that work.
Edit:
Now that Facebook's changed their UI on the main messaging page, I'm not so sure if this hack works anymore. I'm going to unaccept this as an answer (but leave it as reference), and pick a new one after I've had a chance to try the other ones out.