Created
December 1, 2011 08:24
-
-
Save MelanieS/1414964 to your computer and use it in GitHub Desktop.
Script finds hubbers that have a authorscore of five and under (hubpages.com)
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
require 'nokogiri' | |
require 'open-uri' | |
=begin __ | |
/ _) | |
_.----._/ / | |
/ / | |
__/ ( | ( | | |
/__.-'|_|--|_| | |
http://hubpages.com/forum/topic/87923 | |
=end | |
def get_hubbers(url) | |
naughty_hubbers = [] | |
page = open(url) | |
Nokogiri::HTML(page).css('div.author_pic').each do |e| | |
author_score = e.at_css("span").text.to_i | |
profile_url = e.at_css("a")['href'] | |
if author_score <= 5 | |
naughty_hubbers << profile_url | |
end | |
end | |
naughty_hubbers | |
end | |
puts "Enter last page url" | |
url = gets | |
list = get_hubbers(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment