Created
July 19, 2010 17:10
-
-
Save mvidner/481674 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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