text: // Generated by LiveScript 1.4.0
  (function(){
    var request, readabilitySAX, cheerio, xmlWriter, htmlparser2, prelude, Url, trim, extract, linksAsRss, out$ = typeof exports != 'undefined' && exports || this;
    request = require('request');
    readabilitySAX = require('readabilitySAX');
    cheerio = require('cheerio');
    xmlWriter = require('xml-writer');
    htmlparser2 = require('htmlparser2');
    prelude = require('prelude-ls');
    Url = require('url');
    trim = function(it){
      return it.replace(/&nbsp;/g, " ").replace(/^\s+/, "").replace(/\s+$/, "");
    };
    extract = function(url, opts, cb){
      request(url, function(_err, _res, page){
        var article, reader, parser, skipLevel, take_links, $;
        article = null;
        reader = new readabilitySAX.Readability({
          pageURL: url,
          resolvePaths: true
        });
        parser = new htmlparser2.Parser(reader, {
          lowerCaseTags: true
        });
        skipLevel = 2;
        do {
          if (skipLevel !== 0) {
            reader.setSkipLevel(skipLevel);
          }
          parser.parseComplete(page);
          article = reader.getArticle();
          skipLevel += 1;
        } while (article.textLength < 250 && skipLevel < 6);
        article.text = trim(reader.getText());
        delete article['score'], delete article['textLength'], delete article['nextPage'];
        take_links = function($){
          return uniqueBy(function(it){
            return it.url;
          })(
          filter(function(it){
            return it.url.match(/http/) && it.text.length > 4;
          })(
          map(function(it){
            return {
              "url": Url.resolve(url, $(it).attr('href')),
              "text": trim(($(it).text() || "").replace(/[ \t\n\r]+/g, " "))
            };
          })(
          $("a[href]").get())));
        };
        $ = cheerio.load(article.html);
        article.links = take_links($);
        if (opts.full) {
          $ = cheerio.load(article.full_html = page.replace(/^\s*/, ""));
          $("script,style").remove();
          article.full_links = take_links($);
          article.full_text_untrimed = $("html").text();
          article.full_text = trim(article.full_text_untrimed.replace(/[ \t\n\r]+/g, " "));
        }
        return cb(article);
      });
    };
    linksAsRss = function(url, cb){
      extract(url, {
        full: true
      }, function(article){
        var xw;
        xw = new xmlWriter();
        xw.startDocument().startElement('rss').writeAttribute('version', '2.0');
        xw.startElement('channel').writeElement('title', article.title).writeElement('link', url);
        article.full_links.map(function(it){
          return xw.startElement('item').writeElement('link', it.url).writeElement('title', it.text).endElement();
        });
        xw.endDocument();
        return cb(xw.toString());
      });
    };
    out$.extract = extract;
    out$.linksAsRss = linksAsRss;
  }).call(this);
  