Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#! /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
You can’t perform that action at this time.