# File referrercop, line 173
def self.extract_awstats(input, type)
  data      = input.read
  extracted = Array.new

  # Extract referrers.
  referrers = data.slice!(REGEXPS[:awstats_pagerefs_extract], 1).strip

  # Extract URLs.
  referrers.each_line do |line|
    @stats.lines += 1

    # Skip over invalid lines.
    unless line =~ REGEXPS[:awstats_url]
      @stats.invalid += 1
      next
    end

    # Examine the URL.
    if spam?($1)
      @stats.spam += 1
      extracted << $1 if type == :spam
    else
      @stats.ham += 1
      extracted << $1 if type == :ham
    end
  end

  extracted.delete('-')
  extracted.delete('')

  return extracted.uniq
end