Skip to content

Instantly share code, notes, and snippets.

@mvidner
Created July 19, 2010 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvidner/481674 to your computer and use it in GitHub Desktop.
Save mvidner/481674 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
# Scrape the user list of forums.opensuse.org to make a list of those
# who have posted at least LIMIT items, for use by the feed filter mentioned in
# http://mvidner.blogspot.com/2010/07/helping-newcomers.html
require "rubygems"
require "nokogiri"
require "open-uri"
LIMIT = 15
PERPAGE = 50
page = 1
count = nil
begin
url = "http://forums.opensuse.org/members/list/index#{page}.html?order=desc&sort=posts&pp=#{PERPAGE}"
$stderr.puts url
doc = Nokogiri::HTML(open url)
doc.css("a.username").each do |u|
count_n = u.at_xpath('../../td[@class="alt1 postcount"]')
count = count_n.content.tr("^0-9", "").to_i
break if count <= LIMIT
$stderr.printf "%5d ", count
puts u.content
end
page += 1
end until count <= LIMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment