duckduckgo 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/duckduckgo/result.rb +13 -1
- data/lib/duckduckgo/search.rb +9 -0
- data/lib/duckduckgo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c33a5106893388b934bfde2c778a95dab6e932b1
|
4
|
+
data.tar.gz: 0b417c2c2e6d282cfb1c75b8601840aaca370515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0113f3c3c6abbbe679069c2c4e163a043bc095ff711d12fefb9ea50ed50b3e17c1df75e153963406dca8d2a522a202ed00a9e6e7b566d29240b141940b1b7d6
|
7
|
+
data.tar.gz: db0975951bb73c4f55da6ad0d2e1a5e5095160b66fab957af8c7a7edbec723a799de84dc2b1250cf3a411c6a375cd1d719248430a535a9094b7e2b59e627f99d
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
47
47
|
|
48
48
|
## Contributing
|
49
49
|
|
50
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/stevesoltys/duckduckgo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/stevesoltys/duckduckgo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
51
51
|
|
52
52
|
|
53
53
|
## License
|
data/lib/duckduckgo/result.rb
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
module DuckDuckGo
|
2
2
|
|
3
|
+
##
|
4
|
+
# This class represents a search result from DuckDuckGo.
|
3
5
|
class SearchResult
|
4
6
|
|
5
|
-
|
7
|
+
##
|
8
|
+
# The URI for this result.
|
9
|
+
attr_reader :uri
|
10
|
+
|
11
|
+
##
|
12
|
+
# The title of this result.
|
13
|
+
attr_reader :title
|
14
|
+
|
15
|
+
##
|
16
|
+
# The description for this result.
|
17
|
+
attr_reader :description
|
6
18
|
|
7
19
|
def initialize(uri, title, description)
|
8
20
|
@uri = uri
|
data/lib/duckduckgo/search.rb
CHANGED
@@ -2,10 +2,19 @@ require 'nokogiri'
|
|
2
2
|
require 'open-uri'
|
3
3
|
require 'cgi'
|
4
4
|
|
5
|
+
##
|
6
|
+
# The DuckDuckGo module.
|
5
7
|
module DuckDuckGo
|
6
8
|
|
9
|
+
##
|
10
|
+
# The suffix for the URL that we visit when querying DuckDuckGo.
|
7
11
|
RESOURCE_URL = 'https://duckduckgo.com/html/?q='
|
8
12
|
|
13
|
+
##
|
14
|
+
# Searches DuckDuckGo for the given query string. This function returns an array of SearchResults.
|
15
|
+
#
|
16
|
+
# @param [String] query the query
|
17
|
+
# @raise [Exception] if there is an error scraping DuckDuckGo for the search results.
|
9
18
|
def self.search(query)
|
10
19
|
results = []
|
11
20
|
|
data/lib/duckduckgo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duckduckgo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Soltys
|
@@ -69,7 +69,6 @@ files:
|
|
69
69
|
- bin/console
|
70
70
|
- bin/setup
|
71
71
|
- duckduckgo.gemspec
|
72
|
-
- duckduckgo.iml
|
73
72
|
- lib/duckduckgo.rb
|
74
73
|
- lib/duckduckgo/result.rb
|
75
74
|
- lib/duckduckgo/search.rb
|
@@ -99,3 +98,4 @@ signing_key:
|
|
99
98
|
specification_version: 4
|
100
99
|
summary: An unofficial DuckDuckGo search API.
|
101
100
|
test_files: []
|
101
|
+
has_rdoc:
|