$extractor = new ContentExtractor(dirname(__FILE__) . '/site_config/custom', dirname(__FILE__) . '/site_config/standard');
$extractor->debug = $debug_mode;
SiteConfig::$debug = $debug_mode;
SiteConfig::use_apc($options->apc);
$extractor->fingerprints = $options->fingerprints;
$extractor->allowedParsers = $options->allowed_parsers;
////////////////////////////////
// Get RSS/Atom feed
////////////////////////////////
if (!$html_only) {
    debug('--------');
    debug("Attempting to process URL as feed");
    // Send user agent header showing PHP (prevents a HTML response from feedburner)
    $http->userAgentDefault = HumbleHttpAgent::UA_PHP;
    // configure SimplePie HTTP extension class to use our HumbleHttpAgent instance
    SimplePie_HumbleHttpAgent::set_agent($http);
    $feed = new SimplePie();
    // some feeds use the text/html content type - force_feed tells SimplePie to process anyway
    $feed->force_feed(true);
    $feed->set_file_class('SimplePie_HumbleHttpAgent');
    //$feed->set_feed_url($url); // colons appearing in the URL's path get encoded
    $feed->feed_url = $url;
    $feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE);
    $feed->set_timeout(20);
    $feed->enable_cache(false);
    $feed->set_stupidly_fast(true);
    $feed->enable_order_by_date(false);
    // we don't want to do anything to the feed
    $feed->set_url_replacements(array());
    // initialise the feed
    // the @ suppresses notices which on some servers causes a 500 internal server error
 public static function set_agent(HumbleHttpAgent $agent)
 {
     self::$agent = $agent;
 }