duckgo 1.1.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0d934faf234d88f43a383ecfa3e20dd1aa1e58f
4
- data.tar.gz: 7314de47148059cd100b1b7ac61121213a490757
3
+ metadata.gz: db9f873a22d18a71f87ef838a110ecb668304e04
4
+ data.tar.gz: 5be7c578227e2dacb4f623e43a0f1e3f350b21fc
5
5
  SHA512:
6
- metadata.gz: c81412466434d637c53743ca276415f49c0c4b0a6a4c55b0ae601fa55d7df053df4bae1a62827824138fdc6854f9719723ffc7e0f286aefd77b8f49ac5e53ac8
7
- data.tar.gz: 53ca76ff164324590185fd019fd92771ba064cbf03f46031bda5164037bdaea1b7ac1be2775fc7e600acc881ab841126a07f59b4d8fbc1c210ca37ecdbf2d79f
6
+ metadata.gz: e53046fc36a7723941ed1fe8b67073e57069b9a773cdcd7bf0257dbca68fef1e4ffe564a9c279e22706311cc082904202996abe4fcb4036c29f02c4c099748bc
7
+ data.tar.gz: 8a6cd711c2a08d2214ba2f9d650a538c80eeae8aae631abd84f7b9c35d8f02ece6ec02a43087aa1bff40403abba17f5911cf564f03373869439c18e5c33e0588
data/bin/duckgo CHANGED
@@ -17,10 +17,11 @@ end
17
17
 
18
18
  help = """DuckGo lets you search duckduckgo.com for instant answers
19
19
 
20
- duckgo [--help | -h] : Display this help
21
- duckgo [--version | -V] : Display version
22
- duckgo something searchable : Auto-handle the search
23
- duckgo \!gem duckgo : Use !bang syntax to search a specific site
20
+ duckgo something searchable : Auto-handle the search
21
+ duckgo [--help | -h] : Display this help
22
+ duckgo [--version | -V] : Display version
23
+ duckgo [--favicon | -f] google.com : Get google's favicon
24
+ duckgo \\!gem duckgo : Use !bang syntax to search a specific site
24
25
 
25
26
  View docs and API on https://github.com/wlib/duckgo
26
27
  Made by Daniel Ethridge | git.io/de
@@ -34,6 +35,14 @@ case ARGV[0]
34
35
  when "--version", "-V"
35
36
  puts "DuckGo v#{VERSION}"
36
37
  exit
38
+ when "--favicon", "-f"
39
+ site = ARGV[1]
40
+ file = File.open("#{site}-favicon.ico", "w")
41
+ favicon = get_favicon(site)
42
+ file.write(favicon)
43
+ puts "Queried favicon from #{site}."
44
+ file.close
45
+ exit
37
46
  else
38
47
  handle(ARGV[0..-1].join(" "))
39
48
  exit
File without changes
data/due.s-favicon.ico ADDED
File without changes
data/lib/duckgo.rb CHANGED
@@ -47,8 +47,10 @@ module DuckGo
47
47
  # Get a website/page's favicon through duckduckgo's proxy
48
48
  def get_favicon(page)
49
49
  favicon = get(nil, "/i/#{page}.ico")
50
- if favicon == "GIF89a\x01\x00\x01\x00\x80\x01\x00\x00\x00\x00\xFF\xFF\xFF!\xF9\x04\x01\x00\x00\x01\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02L\x01\x00;"
51
- puts "Response is 200-OK, but content is a generic response"
50
+ require 'digest'
51
+ generic_resp = "ad4b0f606e0f8465bc4c4c170b37e1a3"
52
+ if Digest::MD5.hexdigest(favicon) == generic_resp
53
+ puts "Warning: response is 200-OK, but content is a generic response\nThis probably means the favicon is unreachable"
52
54
  return nil
53
55
  else
54
56
  return favicon
@@ -1,3 +1,3 @@
1
1
  module DuckGo
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duckgo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Ethridge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-05 00:00:00.000000000 Z
11
+ date: 2017-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -54,9 +54,11 @@ files:
54
54
  - Rakefile
55
55
  - bin/duckgo
56
56
  - bin/setup
57
+ - de.surge.sh-favicon.ico
57
58
  - docs/README.md
58
59
  - docs/getting_data.md
59
60
  - duckgo.gemspec
61
+ - due.s-favicon.ico
60
62
  - lib/duckgo.rb
61
63
  - lib/duckgo/version.rb
62
64
  homepage: https://github.com/wlib/duckgo