Dump IMDB season info

by gradbot

JavaScript

javascript:(function($) {
  $.getScript("http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js");
  
  var seasons = $.map($(".season-filter-all"), function(season) {
    return {
      title: $.trim($(".season-header", season).text()),
      episodes: $.map($("table", season), function(episode) {
        var $episode = $("td:last", episode);
        var title = $.trim($("h3", $episode).text());
        $("h3, .less-emphasis", $episode).remove();
        var description = $.trim($episode.text());
        return {
          title: title,
          description: description
        };
      }) 
    };
  });
  
  var $output = $("<textarea></textarea>")
    .val(JSON.stringify(seasons, null, "    "))
    .click(function() {
      this.select();
    });
  
  $("body").html($output);
})(jQuery);