Created
January 17, 2012 08:50
-
-
Save dongyuwei/1625714 to your computer and use it in GitHub Desktop.
find the website/blog of github top coder
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
require 'rubygems' | |
require 'nokogiri' | |
require 'net/http' | |
require 'openssl' | |
require 'open-uri' | |
class Net::HTTP | |
alias_method :origConnect, :connect | |
def connect | |
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
origConnect | |
end | |
end | |
Blog_links = [] | |
def find_coder_blog_link url | |
doc = Nokogiri::HTML(open(url)) | |
doc.css('td.owner > a').each do |link| | |
href = "https://github.com#{link.attribute('href')}" | |
#puts href | |
doc = Nokogiri::HTML(open(href)) | |
if doc.css('a.url').length > 0 | |
href = doc.css('a.url')[0].attribute('href') | |
puts href # name is doc.css('dd.fn')[0] | |
Blog_links.push(href) | |
end | |
end | |
end | |
['https://github.com/popular/forked','https://github.com/popular/watched'].each do |url| | |
find_coder_blog_link(url) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment