Extracting a Trello board as markdown

(or "web scraping from the chrome console, with jquery")

Updated for 2020 😁

Assuming you use Trello and the Chrome browser, here's a technique for extracting a trello board onto your clipboard as plain text.

Navigate to the Trello board you want to grab, and bring up the chrome developer tools ([F12], or [Ctrl]+[Shift]+[I], or Tools → Developer Tools)

Go to the console (chrome console icon is a greater than followed by an equivalence indicator) -- and enter this piece of javascript. (Don't read it.... just enter it... trust me).

var s=[];s.push("# "+jQuery(".board-header").children()[0].innerText);jQuery(".list:has(.list-header-name)").each(function() {s.push("\n## "+jQuery(this).find(".list-header-name-assist")[0].innerText+"\n");jQuery(this).find(".list-card-title").each(function() {s.push("* "+this.innerText);});});copy(s.join("\n"));

Okay -- spaced out over a couple of lines it reads:


var s = [];
s.push("# " + jQuery(".board-header").children()[0].innerText);
jQuery(".list:has(.list-header-name)").each(function() {
    s.push("\n## " + jQuery(this).find(".list-header-name-assist")[0].innerText + "\n");
    jQuery(this).find(".list-card-title").each(function() {
        s.push("* " + this.innerText);
    });
});
copy(s.join("\n"));

The whole trello board will now be on your clipboard, in nature's favorite format: markdown.

Use the intrinsic 'copy' function to copy a value to the clipboard

One lesson I learnt while putting this together: you can use copy in the console to put a value onto the clipboard. This doesn't work in regular pages, for security reasons.

Inject jQuery into a page

If you want to use this kind of data-extraction technique on a page that doesn't have jQuery, then you'll want a simple technique for injecting jQuery into a page.

Just pop down to the console and paste this:

var script = document.createElement("script");
script.src = "http://code.jquery.com/jquery-latest.min.js";
document.body.appendChild(script);

jQuery will now be available on that page, and you can sizzle to your heart's content.

Caveats:

  1. You may first want to make sure jquery isn't already loaded.
  2. And you have to make sure the 'script' variable doesn't overwrite any existing variable of the same name.
  3. You may want a specific jQuery version.
  4. Use at your own risk, no warranty or replacement for lost limbs etc.
 

My book "Choose Your First Product" is available now.

It gives you 4 easy steps to find and validate a humble product idea.

Learn more.

(By the way, I read every comment and often respond.)

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.