ud 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ud.rb +10 -7
  3. metadata +21 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11f8394cb33159ae220771206f5c66611840532a
4
- data.tar.gz: ed5b562d420f7a2e071a9da934c0b8528978674f
3
+ metadata.gz: 2134c365e3c168e488e70bd92781de30d419787b
4
+ data.tar.gz: 41f9521a67fcbd7a13af576b72ad0487b912634e
5
5
  SHA512:
6
- metadata.gz: 6d3b91414b1ee2f7ba0543ffc684892bc0d064f2e762623a22ab85a792a20883b5b565684ad801c6ddf3f2bf49106e043530dbc9ae63618620962b98dc3091a0
7
- data.tar.gz: 8cfe02567efc781a86af680b6d2a11bbeb4e6f81440ea543f7aa1523500381d2aad36adb5287c115faa8a07bd108877da4bf79aca5263719f5c4190e98336b7f
6
+ metadata.gz: 046591e9726d26e77674979759936e8337a0048b4102db0493edec4431d47796f61171d6ff4f767c237568245bcd5c8052c87c5208918a9503c43a4ce6f5361a
7
+ data.tar.gz: 323c6c600173bf87c696dd26a1ae4e66649223728ff760c69544b2c98891a534cefea349f4f2ba3d84b8878970e5137d85c0aefbbf3426db81e662beb58fcdf0
data/lib/ud.rb CHANGED
@@ -14,7 +14,7 @@ module UD
14
14
 
15
15
  # The current version of the module
16
16
  def UD.version
17
- '0.1.2'
17
+ '0.1.3'
18
18
  end
19
19
 
20
20
  # Get the search URL to query for a given term.
@@ -71,8 +71,10 @@ module UD
71
71
 
72
72
  return [] unless doc.css('#not_defined_yet').empty?
73
73
 
74
- words = doc.css('.word[data-defid]')
75
- ids = words.take(opts[:count]).map { |w| w.attr('data-defid') }
74
+ words = doc.css('#entries .box')
75
+ ids = words.take(opts[:count]).map do |w|
76
+ w.css('.thumb.up').first.attr('data-defid')
77
+ end
76
78
 
77
79
  thumbs = thumbs(ids)
78
80
 
@@ -85,15 +87,16 @@ module UD
85
87
 
86
88
  ids.map do |id|
87
89
 
88
- word = text doc.css(".word[data-defid=\"#{id}\"] > span").first
89
- body = doc.css("#entry_#{id}")
90
+ box = doc.css(".add_to_list[data-defid=\"#{id}\"]").first.parent
91
+
92
+ word = text box.css(".word > a").first
90
93
  t = thumbs[id.to_i] || {}
91
94
 
92
95
  {
93
96
  :id => id,
94
97
  :word => word,
95
- :definition => text(body.css('.definition')),
96
- :example => text(body.css('.example')),
98
+ :definition => text(box.css('.definition')),
99
+ :example => text(box.css('.example')),
97
100
  :upvotes => t[:up],
98
101
  :downvotes => t[:down]
99
102
 
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baptiste Fontaine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-11 00:00:00.000000000 Z
11
+ date: 2014-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.5.9
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.5.9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: trollop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: colored
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: test-unit
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: fakeweb
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Get words' definitions from Urban Dictionary on the command-line.
@@ -145,17 +145,17 @@ require_paths:
145
145
  - lib
146
146
  required_ruby_version: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - ">="
148
+ - - '>='
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ">="
153
+ - - '>='
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
- rubygems_version: 2.1.6
158
+ rubygems_version: 2.0.3
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: Urban Dictionary unofficial scrapper