BountySource scraper
This file contains 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 | |
require "httparty" | |
require "pry" | |
bounties = [] | |
issue_id = 0 | |
errors_count = 0 | |
until errors_count > 10 | |
issue_id = issue_id + 1 | |
url = "https://api.bountysource.com/issues/#{issue_id}" | |
print "#{url}..." | |
sleep 1 | |
response = HTTParty.get(url) | |
if response.code == 200 | |
print "OK" | |
errors_count = 0 | |
else | |
puts response.code | |
errors_count = errors_count + 1 | |
next | |
end | |
bounty = response["bounty_total"].to_f | |
puts " - #{bounty}" | |
if bounty > 0 | |
bounties << {url: response["frontend_url"], amt: bounty} | |
puts "Already #{bounties.count} paid bounties found." | |
end | |
end | |
puts | |
puts "RESULTS:" | |
bounties.sort_by! {|bounty| bounty[:amt] } | |
bounties.each {|bounty| puts "$#{bounty[:amt]} for #{bounty[:url]}" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By the way, you can use our QA site for testing: https://www-qa.bountysource.com