FreedomCoder-esearchy 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -69,7 +69,7 @@ Not short of that now, we also have the possibility of choosing between a Librar
69
69
  d.yahoo_key = "dsdsdsdsdsdsdsd"
70
70
  d.bing_key = "dsdsdsdsdsdsdsdsd"
71
71
  d.company_name "Domain Corp"
72
- d.linkedin_credentials "myuser@linkedin.com", "12345"
72
+ d.linkedin_credentials "myuser@linkedin.com", "12345" # or use the constant ESearch::BUGMENOT
73
73
  d.maxhits = 500
74
74
  d.search
75
75
  end
data/lib/esearchy/bing.rb CHANGED
@@ -27,7 +27,7 @@ class Bing
27
27
  http.start do |http|
28
28
  request = Net::HTTP::Get.new("/json.aspx" + "?Appid="+ @appid +
29
29
  "&query=" + CGI.escape(query) +
30
- "&sources=web&web.count=50&start=#{@start}",
30
+ "&sources=web&web.count=50&web.offset=#{@start}",
31
31
  {'Cookie' => UserAgent::fetch})
32
32
  response = http.request(request)
33
33
  case response
@@ -0,0 +1,19 @@
1
+ require 'base64'
2
+
3
+ class BMN
4
+ def self.decode(input, offset)
5
+ # thanks tlrobinson @ github
6
+ input.unpack("m*")[0][4..-1].unpack("C*").map{|c| c - offset }.pack("C*")
7
+ end
8
+
9
+ def self.fetch_user
10
+ url = Net::HTTP.get URI.parse('http://www.bugmenot.com/view/linkedin.com')
11
+ key = ( url.scan(/var key =(.*);/)[0][0].to_i + 112 ) / 12
12
+
13
+ user, pass = url.scan(/tr><th>Username <\/th><td><script>d\('(.*)'\);<\/script><\/td><\/tr>
14
+ [\n\s]+<tr><th>Password <\/th><td><script>d\('(.*)'\);<\/script><\/td><\/tr>/)[0]
15
+ user = decode(user,key)
16
+ pass = decode(pass,key)
17
+ return user, pass
18
+ end
19
+ end
data/lib/esearchy.rb CHANGED
@@ -1,11 +1,17 @@
1
1
  local_path = "#{File.dirname(__FILE__) + '/esearchy/'}"
2
- %w{google bing yahoo pgp keys linkedin logger}.each { |lib| require local_path + lib }
2
+ %w{google googlegroups bing yahoo pgp keys
3
+ linkedin logger bugmenot}.each { |lib| require local_path + lib }
3
4
 
4
5
  class ESearchy
6
+ #Constants
7
+
5
8
  LIBRARY = 1
6
9
  APP = 2
7
10
 
8
11
  LOG = Logger.new(1, $stdout)
12
+ BUGMENOT = BMN::fetch_user
13
+
14
+ #End Constants
9
15
 
10
16
  def log_type=(value)
11
17
  ESearchy::LOG.level = value
@@ -76,9 +82,17 @@ class ESearchy
76
82
  @engines[:Bing].appid = value
77
83
  end
78
84
 
79
- def linkedin_credentials(user, pass)
80
- @engines[:LinkedIn].username = user
81
- @engines[:LinkedIn].password = pass
85
+ def linkedin_credentials(*args)
86
+ if args.size == 2
87
+ @engines[:LinkedIn].username = args[0]
88
+ @engines[:LinkedIn].password = args[1]
89
+ return true
90
+ elsif args.size ==1
91
+ @engines[:LinkedIn].username = args[0][0]
92
+ @engines[:LinkedIn].password = args[0][1]
93
+ return true
94
+ end
95
+ false
82
96
  end
83
97
  alias_method :linkedin_credentials=, :linkedin_credentials
84
98
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: FreedomCoder-esearchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias P. Brutti
@@ -72,6 +72,7 @@ files:
72
72
  - lib/esearchy/wcol.rb
73
73
  - lib/esearchy/useragent.rb
74
74
  - lib/esearchy/logger.rb
75
+ - lib/esearchy/bugmenot.rb
75
76
  - README.rdoc
76
77
  has_rdoc: true
77
78
  homepage: http://freedomcoder.com.ar/esearchy