Class: ESearchy::Bugmenot

Inherits:
Object
  • Object
show all
Defined in:
lib/esearchy/bugmenot.rb

Class Method Summary collapse

Class Method Details

.fetch(domain = "www.linkedin.com") ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/esearchy/bugmenot.rb', line 5

def self.fetch(domain = "www.linkedin.com")
  begin
    url = Net::HTTP.get URI.parse("http://www.bugmenot.com/view/#{domain}")
    key = ( url.scan(/var key =(.*);/)[0][0].to_i + 112 ) / 12

    user, pass = url.scan(/tr><th>Username <\/th><td><script>d\('(.*)'\);<\/script><\/td><\/tr>
  [\n\s]+<tr><th>Password <\/th><td><script>d\('(.*)'\);<\/script><\/td><\/tr>/)[0]
    user = decode(user,key)
    pass = decode(pass,key)
    return [user, pass]
  rescue
    return [nil,nil]
  end
end