gsearch-parser 0.3.4 → 0.3.5

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gsearch-parser"
8
- s.version = "0.3.4"
8
+ s.version = "0.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Diego Netto"]
@@ -8,7 +8,12 @@ module GSearchParser
8
8
 
9
9
  # Entry method for performing a web search
10
10
  def GSearchParser.webSearch(query)
11
- webSearch = GoogleWebSearch.new(query)
11
+ webSearch = GoogleWebSearch.new(query, 'QUERY')
12
+ end
13
+
14
+ # Allows directly specifing the URI of the page to parse
15
+ def GSearchParser.parseSearchPage(uri)
16
+ webSearch = GoogleWebSearch.new(uri, 'URI')
12
17
  end
13
18
 
14
19
  end
@@ -21,12 +26,16 @@ class GoogleWebSearch
21
26
  @currentPage
22
27
 
23
28
  # Class initializer
24
- def initialize(query)
29
+ def initialize(arg1, flag)
25
30
  # Initialize variables
26
31
  @results = Array.new
27
32
 
28
- # Update the results list: (Fetch, Store, and Parse)
29
- updateResults("http://google.com/search?sourceid=chrome&q=#{query}")
33
+ case flag
34
+ when 'QUERY'
35
+ updateResults("http://google.com/search?sourceid=chrome&q=#{arg1}")
36
+ when 'URI'
37
+ updateResults(arg1)
38
+ end
30
39
 
31
40
  # Update next URI
32
41
  updateNextURI
@@ -45,7 +54,7 @@ class GoogleWebSearch
45
54
  def updateResults(url)
46
55
  # Fetch
47
56
  searchPage = fetchPage(url)
48
-
57
+ puts url
49
58
  # Store
50
59
  @currentPage = searchPage
51
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gsearch-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: