tinysong 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ca2c3100be3cf5b86dfc467ddecb248a2bab036e
4
+ data.tar.gz: 99a282697e85519da0db578549604e784e2bc81c
5
+ SHA512:
6
+ metadata.gz: 6a72be5c01beb6bfa69a241401ebc89870dbd557b71b6798a6123a4991e9963787d41dccb3c4dc8132b6c44bf588d0a75b5b382bb157462e0ca421dcb5dc1a84
7
+ data.tar.gz: 21956a1c9eac0ac036097a6fc836803fb88db571525263c6893d2108a3599fa998f1ac5902c1578fb9aff92fafa7b7d6c8e0796e23fe006452d2a98112d04793
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,5 @@
1
+ --color
2
+ -fs
3
+ -Ilib
4
+ -Ispec
5
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tinysong.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Linus Oleander
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # Tinysong
2
+
3
+ Scrapes tinysong.com, which means that there aren't any request limitations.
4
+
5
+ ## Installation
6
+
7
+ $ [sudo] gem install tinysong
8
+
9
+ ## Usage
10
+
11
+ ``` ruby
12
+ songs = Tinysong::Search.all("smoke on the water deep purple")
13
+ songs.each do |song|
14
+ song.artist # => "Deep Purple"
15
+ song.title # => "Smoke on the Water"
16
+ song.href # => "http://tinysong.com/RjVu"
17
+ song.id # => 33682674
18
+ end
19
+ ```
20
+
21
+ ``` ruby
22
+ song = Tinysong::Search.find("smoke on the water deep purple")
23
+ ```
24
+
25
+ **Note:** `Tinysong::Search` does N + 1 requests, so if you only need one result use `Tinysong::Search.find`.
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,2 @@
1
+ require "tinysong/version"
2
+ require "tinysong/search"
@@ -0,0 +1,54 @@
1
+ require "rest_client"
2
+ require "nokogiri"
3
+ require "json"
4
+
5
+ module Tinysong
6
+ Song = Struct.new(:title, :artist, :href, :id)
7
+
8
+ class Search < Struct.new(:search, :amount)
9
+ #
10
+ # Search and return first result
11
+ #
12
+ # @search String Track to be found
13
+ # @return Song A song
14
+ #
15
+ def self.find(search)
16
+ Search.new(search, 1).perform.first
17
+ end
18
+
19
+ #
20
+ # Search and return all songs
21
+ #
22
+ # @search String Track to be found
23
+ # @options[:limit] Amount of results
24
+ # @return Array<Song> A list of songs
25
+ #
26
+ def self.all(search, options = {})
27
+ limit = options[:limit] || -1
28
+ Search.new(search, limit).perform
29
+ end
30
+
31
+ def perform
32
+ res = JSON.parse(RestClient.post("http://tinysong.com/?s=s", {q: [search, 0]}))
33
+ res = Nokogiri::HTML(res["html"]).css("ul.result")
34
+ res.take(limit(res)).map do |result|
35
+ song_id = result.attr("rel").match(/^(\d+)/).to_a.last
36
+ res = JSON.parse(RestClient.post("http://tinysong.com/?s=sh", {q: [song_id, "search", search]}))
37
+ build(Nokogiri::HTML(res["message"]), song_id)
38
+ end
39
+ end
40
+
41
+ private
42
+
43
+ def build(element, song_id)
44
+ artist = element.at_css("h3").text
45
+ title = element.at_css("h2").text
46
+ href = element.at_css(".link a").attr("href")
47
+ Song.new(title, artist, href, song_id.to_i)
48
+ end
49
+
50
+ def limit(res)
51
+ amount == -1 ? res.length : amount
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,3 @@
1
+ module Tinysong
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,566 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://tinysong.com/?s=s
6
+ body:
7
+ encoding: US-ASCII
8
+ string: q[]=smoke%20on%20the%20water%20deep%20purple&q[]=0
9
+ headers:
10
+ Accept:
11
+ - '*/*; q=0.5, application/xml'
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '50'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - richhickey
27
+ Date:
28
+ - Mon, 22 Apr 2013 13:03:54 GMT
29
+ Content-Type:
30
+ - text/html; charset=UTF-8
31
+ Content-Length:
32
+ - '594'
33
+ Connection:
34
+ - close
35
+ Set-Cookie:
36
+ - TinysongSessionID=7e65216bddd13efad686a4da16073918; expires=Mon, 18-Apr-2016
37
+ 13:03:53 GMT; path=/
38
+ Cache-Control:
39
+ - max-age=300
40
+ Expires:
41
+ - Mon, 22 Apr 2013 13:08:53 GMT
42
+ Vary:
43
+ - Accept-Encoding
44
+ Content-Encoding:
45
+ - gzip
46
+ X-Hostname:
47
+ - rhl110
48
+ - rhl110
49
+ body:
50
+ encoding: ASCII-8BIT
51
+ string: !binary |-
52
+ H4sIAAAAAAAAA+WXyW7bMBCGX2WqQ5ECVazN8gLVhyIGfEhbwU7RiwCDkRlb
53
+ MLWUpLIgyLt3tFqynDa9Wa0OBjnkzPwz80mAn5WdDJkyVaDxOJvgHnxGhPjk
54
+ KZyKlMn1AydJQrmnQLA5YZ15ERw9TsqOgqAzpwy3pmmPDXtkqYIS7u9yd086
55
+ LKgdShMam1rEjmCkONp2EjoiIVF97zaVMo7w0ipzcLxBdtrwQAuGbRhO5EoY
56
+ eaqqFVytJHdqeKsUF+P9RkmW/4QKyYm/r5uBhymr1+2OlW1ZhfGeQhyB3FH4
57
+ QSTlmIIFrzgRLgOBc5ldUZqAm/KE0fZ93NUp/yTWZzhODNa4VwUrwmSNbrYK
58
+ 7e9UFZaLa13XwBuANbGHQyNbaaCqx419HSjDtCxraA57BFQluVPDWQL1LYKb
59
+ Cii4uA7u6Yf/gSvd0kx9Mu4TV5XkTg1nxtXVfO6C+33pXs/fRFKXwz4CZdiG
60
+ ObJtrUdAVZI7NZwZUCc+VIamjeFiRaIND36mFN7DDRF7PFgQzugTLGkYPP7L
61
+ HzLAXQO+oa1PRrrRJ/hKyZ0azgy+zymPes1R7lkGi/Jk+QjCmNN1wZLAGVQC
62
+ 2uaysfkEZk4QbkFwP6Np8EBvg8hn6YYKb+AL/AlCss02pfM6i3SZZD08IJB3
63
+ 9AseQHnrMMAGQn9bofJRyTN8JSHFPzzFO4DGkAqBmtDURkjSR9mu7TB0yYux
64
+ LyiKRNZBxGGt9rIlN19hml0sZFSkLkSiDTNw4hJOQqFMn5X47k5QqUx1/eXl
65
+ F+Hu80aZDQAA
66
+ http_version:
67
+ recorded_at: Mon, 22 Apr 2013 13:03:54 GMT
68
+ - request:
69
+ method: post
70
+ uri: http://tinysong.com/?s=sh
71
+ body:
72
+ encoding: US-ASCII
73
+ string: q[]=33682674&q[]=search&q[]=smoke%20on%20the%20water%20deep%20purple
74
+ headers:
75
+ Accept:
76
+ - '*/*; q=0.5, application/xml'
77
+ Accept-Encoding:
78
+ - gzip, deflate
79
+ Content-Length:
80
+ - '68'
81
+ Content-Type:
82
+ - application/x-www-form-urlencoded
83
+ User-Agent:
84
+ - Ruby
85
+ response:
86
+ status:
87
+ code: 200
88
+ message: OK
89
+ headers:
90
+ Server:
91
+ - richhickey
92
+ Date:
93
+ - Mon, 22 Apr 2013 13:03:54 GMT
94
+ Content-Type:
95
+ - text/html; charset=UTF-8
96
+ Content-Length:
97
+ - '1568'
98
+ Connection:
99
+ - close
100
+ Set-Cookie:
101
+ - TinysongSessionID=0b397eb09ccfa1c20ee4169881e71b8a; expires=Mon, 18-Apr-2016
102
+ 13:03:54 GMT; path=/
103
+ Cache-Control:
104
+ - max-age=300
105
+ Expires:
106
+ - Mon, 22 Apr 2013 13:08:54 GMT
107
+ Vary:
108
+ - Accept-Encoding
109
+ Content-Encoding:
110
+ - gzip
111
+ X-Hostname:
112
+ - rhl072
113
+ - rhl072
114
+ body:
115
+ encoding: ASCII-8BIT
116
+ string: !binary |-
117
+ H4sIAAAAAAAAA9VZe2/bNhD/KqyB9AHHdupkaesmzoItXTGkRdZ03T8CDEqi
118
+ LdYUKVCUHa/Id9+Rer9sOU2xjQgck7w73v3ujo/zt56nfNab9FChWfzMpSvk
119
+ MByG51bPYTSwBZau1UPULQ7M4JuztHpTi1vK8DTNzwjXrKHaMAKzgQipooJP
120
+ JGFY0RV5CwLOqL9AoXRg3hqtiU25w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bGZQHkUJqE+jE9Kjr
137
+ Ep2TgEqkB5IU4tjXPRtUPR2nJqY9uOPWQw3aDie2KFTjMgo2XMXaLKo5x0QC
138
+ eKMjbx0VRe6U2afgseCSO/1yyBHSLxdj2M/6w2w8GV5zKfxLCKkUsUI/3pSa
139
+ mLsZWM297yf8n2E+lxSeuQ2gK1GEPOvlgNc4fyDizaTldxFYCvcDnMKNwigI
140
+ hFSZBZX5RN+dcNbckT/AdvFWX35lZ3bgziHYqeYepDWdKOed8fg+mxIJqS8q
141
+ cZlEXva4jB0HvoK7CGYfsuE4Bi+Vwo4HR09KgBLGYaG+AHdAOWdiPUHxnqxr
142
+ Nu2MgGKq2n/MRaXbSAe1/oW4a83SmKS6ytangOHL6nLZJQAcmxpVGNtyLJfk
143
+ hY6kQXlnHH3FKxyPd5ajW0jUZ+oTEann84g7uiz4/AX61l2Abp9SE4YOBJwi
144
+ z/dj1+3Z6bW7WizWl6Z9kK+v76Tj/u5EVxtp//H+/cebv2++0DtGnh0+QHiG
145
+ 8UO49+fYE760wUXPJxP0bO1R9SA7dXMwYzZ2lpOCV+bCicIZXGTh1RKS2ZwS
146
+ 5u4v/f5HQ/fibXf6+0P08qgrg36pmdSYdkrXHQf7jp2iXjvM66AN0hrEJDf3
147
+ mK1JVOs9KD96NEm8PcTP4vQMintX2cV7Cw6JXtqepFR/C9ekrFRfK8m3SzGY
148
+ xapPW60uYluiSajMbq5fM+X3TeF3gMoruFqvrryDH78+nilfxgImngwG6NP7
149
+ 66NXY2SN0Mmb0zevT/S3IzQYAGPvsGeW+Ai+601iT8NYcpjDSE0TQ6Ikzn77
150
+ MRTeeGpKSgjCRr8aTUkJtILxnOZ4qgtMKC4w6cnj1NRWu81qkSy+t0vzcZGv
151
+ +BbH9cp0UyWmXump/FQT3/qnW6SUai1lE9JO7/4fFKbSemUbAAA=
152
+ http_version:
153
+ recorded_at: Mon, 22 Apr 2013 13:03:55 GMT
154
+ - request:
155
+ method: post
156
+ uri: http://tinysong.com/?s=sh
157
+ body:
158
+ encoding: US-ASCII
159
+ string: q[]=23444535&q[]=search&q[]=smoke%20on%20the%20water%20deep%20purple
160
+ headers:
161
+ Accept:
162
+ - '*/*; q=0.5, application/xml'
163
+ Accept-Encoding:
164
+ - gzip, deflate
165
+ Content-Length:
166
+ - '68'
167
+ Content-Type:
168
+ - application/x-www-form-urlencoded
169
+ User-Agent:
170
+ - Ruby
171
+ response:
172
+ status:
173
+ code: 200
174
+ message: OK
175
+ headers:
176
+ Server:
177
+ - richhickey
178
+ Date:
179
+ - Mon, 22 Apr 2013 13:03:55 GMT
180
+ Content-Type:
181
+ - text/html; charset=UTF-8
182
+ Content-Length:
183
+ - '1587'
184
+ Connection:
185
+ - close
186
+ Set-Cookie:
187
+ - TinysongSessionID=cddcc8e6c4c5068ef25a90db8a76b67b; expires=Mon, 18-Apr-2016
188
+ 13:03:55 GMT; path=/
189
+ Cache-Control:
190
+ - max-age=300
191
+ Expires:
192
+ - Mon, 22 Apr 2013 13:08:55 GMT
193
+ Vary:
194
+ - Accept-Encoding
195
+ Content-Encoding:
196
+ - gzip
197
+ X-Hostname:
198
+ - rhl060
199
+ - rhl060
200
+ body:
201
+ encoding: ASCII-8BIT
202
+ string: !binary |-
203
+ H4sIAAAAAAAAA9VZe2/bNhD/KqyBtCkc26nzQOomzoItXTCkbdpk2z8CDEqi
204
+ Lc4UKVCUHa/od9+ReluSLacpthGBY5J3x7vf3fFx/trxlM86ow4qNIufu3SB
205
+ HIbD8MLqOIwGtsDStTqIusWBCXxz5lZnbHFLGZ66+QnhmjVUK0ZgNhAhVVTw
206
+ kSQMK7og70DAOfVnKJQOzFuDJbEpd1jkktAaOCF8UB/PdCf0sCQTRwSrbI1+
207
+ wGcF6T6WM8p7ks48NUInweM7FGDXpXzWUyIYoTcwAuTWYHweBpiPfwZZ6IHy
208
+ VSj4DDHK50gJtBKRRPkS57CyJob/YCRYm35RYHgDWGHkOAR0r2CWTcSo7Wp4
209
+ wv5ks+9j/mnE2AqB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AV6IIedbLAa9w/kDE60nL
226
+ ryWwFK4KOIUbhVEQCKkyC9bmE323wllxR/4s28a7/h4sO7MFdw7BVjV3IK3o
227
+ RDlvjcf32ZRISH2xFpdJ5GVPzthx4Cu4i2D2IRuOY/BKKex4cPSkBChh7Beq
228
+ DnAHlFMmliMU78m6ktPMCCimqv3HXFS6jbRQ61+Iu8YsjUnWV9n4KjB8WbUu
229
+ uwSAY1OjCmMbjuWSvNCRNCjvjIO/8ALH463l6BYS9UB9IiK1P424o4uF+6/R
230
+ 1/YCdPuSmtB3IOAU2d+NXbdXp7fuYjZbXpn2QZ7dPkrH/c2JrlfS/nxz8/Hu
231
+ 77s/6CMjrw6eIDzD+Cncu3PsCF/a4KLnkxF6tfSoepKdujmYMRs781HBK1Ph
232
+ ROEELrLwagnJZEoJc3eX/u1HQ/f6XXv6bwfozWFbBv1SM6kxbpWuWw72LTtF
233
+ taKYV0drpNWISW7uMVudqMZ7UH70aJJ4e4ifxekZFPeus4v3BhwSvbQ9SQH/
234
+ Hq5JWQG/UqhvlmIwi1UfN1pdxLZEk1CZ3Vy/Zsrvm8KvA2uv4PUq9to7+Pmr
235
+ 5pnyZSxg4kWvh77c3B6eHiJrgI7fnr49O9bfDlGvB4ydg45Z4iP4rjOKPQ1j
236
+ yWEOIxVNDImSOPtFyFB4w7GpLqFPHD3Aq9FUl9C+ri29BuVgOic9Gus6E4rr
237
+ THryKLW40XyzaCSLz+7SfFz2Kz7JcbVsXVeQqRZ81n7HiS//4w1SSiWXsglp
238
+ p/PtH7BbnLWCGwAA
239
+ http_version:
240
+ recorded_at: Mon, 22 Apr 2013 13:03:55 GMT
241
+ - request:
242
+ method: post
243
+ uri: http://tinysong.com/?s=sh
244
+ body:
245
+ encoding: US-ASCII
246
+ string: q[]=14031985&q[]=search&q[]=smoke%20on%20the%20water%20deep%20purple
247
+ headers:
248
+ Accept:
249
+ - '*/*; q=0.5, application/xml'
250
+ Accept-Encoding:
251
+ - gzip, deflate
252
+ Content-Length:
253
+ - '68'
254
+ Content-Type:
255
+ - application/x-www-form-urlencoded
256
+ User-Agent:
257
+ - Ruby
258
+ response:
259
+ status:
260
+ code: 200
261
+ message: OK
262
+ headers:
263
+ Server:
264
+ - richhickey
265
+ Date:
266
+ - Mon, 22 Apr 2013 13:03:55 GMT
267
+ Content-Type:
268
+ - text/html; charset=UTF-8
269
+ Content-Length:
270
+ - '1574'
271
+ Connection:
272
+ - close
273
+ Set-Cookie:
274
+ - TinysongSessionID=1636e0df4aee765441ac357f38e3431e; expires=Mon, 18-Apr-2016
275
+ 13:03:55 GMT; path=/
276
+ Cache-Control:
277
+ - max-age=300
278
+ Expires:
279
+ - Mon, 22 Apr 2013 13:08:55 GMT
280
+ Vary:
281
+ - Accept-Encoding
282
+ Content-Encoding:
283
+ - gzip
284
+ X-Hostname:
285
+ - rhl072
286
+ - rhl072
287
+ body:
288
+ encoding: ASCII-8BIT
289
+ string: !binary |-
290
+ H4sIAAAAAAAAA9VZe2/bNhD/KqyB9AHHdl7tWjdxFnTJiiFtsybd/hFgUBJt
291
+ caZIgaLseEW/+47U+2XLaYptROCY5N3x7nd3fJy/9jzls964hwrN4qcuXSKH
292
+ 4TA8s3oOo4EtsHStHqJucWAK35yF1ZtY3FKGp2l+SrhmDdWaEZgNREgVFXws
293
+ CcOKLslbEHBK/TkKpQPz1mhFbModFrkktEZOCB/Ux3PdCT0sydQRwTpbYxjw
294
+ eUG6j+Wc8oGkc0+N0cvg/i0KsOtSPh8oEYzRIYwAuTWanIYB5pN3IAvdUb4O
295
+ BZ8jRvkCKYHWIpIoX+IUVtbE8B+MBGvTLwoMbwErjByHgO41zLKJGLVdDU/Y
296
+ H2z2bcw/ixhbIxBIiastzvR7kltXtc0W94gTtRJyERadns7DSslwZcLBATKq
297
+ aU9nwpuoGJlViIpfi9Q+GAHYNC+oNbUjpQQPM4INynZXuKPShiyLEWXiBD51
298
+ cm00ooHEeF7HZThdSRwERJbUNvQRi4Mspy3RJFSM5savqFJEIhNEJcq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+ 3pN1zaadEVBMVfuPuah0G+mg1r8Qd61ZGpNUV9n4FDB8WV0uuwSAY1OjCmMb
316
+ juWSvNCRNCjvjKO/8BLH453l6BYSdUd9IiL1fBZxR5cFn79AX7sL0O1zasLQ
317
+ gYBT5Plu7Lo9e3XtLufz1YVpH+Tr63vpuL850eVa2r+/f//x5u+bP+g9I8/2
318
+ HyA8w/gh3Ltz7Ahf2uCi55MxerbyqHqQnbo5mDEbO4txwSsz4UThFC6y8GoJ
319
+ yXRGCXN3l/7tR0P34m13+m/76PCgK4N+qZnUmHRK1y0H+5adol47zOugDdIa
320
+ xCQ395itSVTrPSg/ejRJvD3Ez+L0DIp7l9nFewMOiV7anqRUfwvXpKxUXyvJ
321
+ t0sxmMWqT1qtLmJbokmozG6uXzPl903hd4DKK7har668gx+/Pp4pX8YCJp4M
322
+ Bujz++uDn46QNUInb169eX2ivx2gwQAYe/s9s8RH8F1vHHsaxpLDHEZqmhgS
323
+ JXH224+h8I4muqSE4pISqAMD+eTxxBSY0CeO7uBJaQpMmuY4NbXVbrNaJIvv
324
+ 7dJ8XOQrvsVxvTLdVImpV3oqP9XEt/7JBimlWkvZhLTT+/YPLAuIwWUbAAA=
325
+ http_version:
326
+ recorded_at: Mon, 22 Apr 2013 13:03:56 GMT
327
+ - request:
328
+ method: post
329
+ uri: http://tinysong.com/?s=sh
330
+ body:
331
+ encoding: US-ASCII
332
+ string: q[]=26237660&q[]=search&q[]=smoke%20on%20the%20water%20deep%20purple
333
+ headers:
334
+ Accept:
335
+ - '*/*; q=0.5, application/xml'
336
+ Accept-Encoding:
337
+ - gzip, deflate
338
+ Content-Length:
339
+ - '68'
340
+ Content-Type:
341
+ - application/x-www-form-urlencoded
342
+ User-Agent:
343
+ - Ruby
344
+ response:
345
+ status:
346
+ code: 200
347
+ message: OK
348
+ headers:
349
+ Server:
350
+ - richhickey
351
+ Date:
352
+ - Mon, 22 Apr 2013 13:03:56 GMT
353
+ Content-Type:
354
+ - text/html; charset=UTF-8
355
+ Content-Length:
356
+ - '1621'
357
+ Connection:
358
+ - close
359
+ Set-Cookie:
360
+ - TinysongSessionID=056227ab1bb62406743070af2471008f; expires=Mon, 18-Apr-2016
361
+ 13:03:56 GMT; path=/
362
+ Cache-Control:
363
+ - max-age=300
364
+ Expires:
365
+ - Mon, 22 Apr 2013 13:08:56 GMT
366
+ Vary:
367
+ - Accept-Encoding
368
+ Content-Encoding:
369
+ - gzip
370
+ X-Hostname:
371
+ - rhl081
372
+ - rhl081
373
+ body:
374
+ encoding: ASCII-8BIT
375
+ string: !binary |-
376
+ H4sIAAAAAAAAA9VZe2/bNhD/KqyBtCkUP+pkXuomzoKtXbD1kTXZ+o8Ag5Zo
377
+ izNFahTlx4p+9x2ptyXbcppiGxE4Jnl3vPvd8XHnzy1P+aw1bKFCs/mFSxfI
378
+ YTgML+2Ww2gwEVi6dgtRtzgwhm/O3G6NbG4rw1M3PyZcs4ZqzQjMBiKkigo+
379
+ lIRhRRfkFQi4oP4MhdKBebu7JBPKHRa5JLS7Tggf1Mcz3Qk9LMnYEcE6W6MT
380
+ 8FlBuo/ljPK2pDNPDdF3weoVCrDrUj5rKxEM0QsYAXK7O7oIA8xHP4IsdE/5
381
+ OhR8hhjlc6QEWotIonyJC1hZE8N/MBKsTb8oMHwLWGHkOAR0r2CWTcSoHWp4
382
+ wv5gs+9i/mnE2BqBQEpcbXGm35Pcuk3bJmKFOFFLIedh0enpPKyUDG9MODhA
383
+ RjXt6Ux4HRUj0w2i4tcitQ9GADb1C2pNJ5FSgocZwQ5lmyvcUGlDlsWIMnEC
384
+ n3pz7TSihsR4XsdlOF5KHAREltQ29BGLgyynLdEkVIzmxi+pUkQiE0QlyoQW
385
+ I0WViaz7mBSCR0GMEQVD4wnDHLY98iSZQt9TKhjaXbubiO04wre7nvDJVaiw
386
+ isJLRkNFOESjpYR154s5sT5w694j1icMDFa/1zu3jvrnd5i7kv4VEegMrHsc
387
+ zmHyBktG1tZH4tPVUf+lNVlbPxESWLeRDBix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vLbzc37279v/6ArRp6dPEB4hvFDuA/nOBC+tMFDzydD
405
+ 9GzpUfUgO3VzMGMT7MyHBa9MhROFY3jIQtYSkvGUEuYeLv3Lt4bu+avm9F9O
406
+ 0IteUwadqZmtMWq0Xfdc7HtOimodMq+p1kirEZO83GO2OlFb30H51aNJ4uMh
407
+ TovTOyjuvc4e3jtwSPTS9iRl/zt4JmVl/0p5f7sUg1ms+mir1UVsSzQJlTnN
408
+ dTZTzm8KvylsZMGbte+NPPjxa+2Z8mUsYOJJu40+3rztnb9AdhedvRy8PD/T
409
+ 33qo3QbG1knLLPEefNcaxp6GseQyh5GKJoZESZz9jmQovP7I1J/QB47uIWs0
410
+ 9Sek60/oOKs+oacorj2huPaETO3pOSgP7Lmo05GuQ6G4DqUnT1NEtsJjlIpk
411
+ MS0vzceFw2LKjqvF8LqCTbUgtPHrUJwcjHZIKZVkyiakndaXfwDVGhMW2BsA
412
+ AA==
413
+ http_version:
414
+ recorded_at: Mon, 22 Apr 2013 13:03:56 GMT
415
+ - request:
416
+ method: post
417
+ uri: http://tinysong.com/?s=sh
418
+ body:
419
+ encoding: US-ASCII
420
+ string: q[]=25619712&q[]=search&q[]=smoke%20on%20the%20water%20deep%20purple
421
+ headers:
422
+ Accept:
423
+ - '*/*; q=0.5, application/xml'
424
+ Accept-Encoding:
425
+ - gzip, deflate
426
+ Content-Length:
427
+ - '68'
428
+ Content-Type:
429
+ - application/x-www-form-urlencoded
430
+ User-Agent:
431
+ - Ruby
432
+ response:
433
+ status:
434
+ code: 200
435
+ message: OK
436
+ headers:
437
+ Server:
438
+ - richhickey
439
+ Date:
440
+ - Mon, 22 Apr 2013 13:03:56 GMT
441
+ Content-Type:
442
+ - text/html; charset=UTF-8
443
+ Content-Length:
444
+ - '1551'
445
+ Connection:
446
+ - close
447
+ Set-Cookie:
448
+ - TinysongSessionID=c0dfc02aeac21e7d27b09f751d0fabe9; expires=Mon, 18-Apr-2016
449
+ 13:03:56 GMT; path=/
450
+ Cache-Control:
451
+ - max-age=300
452
+ Expires:
453
+ - Mon, 22 Apr 2013 13:08:56 GMT
454
+ Vary:
455
+ - Accept-Encoding
456
+ Content-Encoding:
457
+ - gzip
458
+ X-Hostname:
459
+ - rhl061
460
+ - rhl061
461
+ body:
462
+ encoding: ASCII-8BIT
463
+ string: !binary |-
464
+ H4sIAAAAAAAAA9VZe2/bNhD/KqyB9AHHduK0WesmztIuWTG0RdZ2+0uAQUm0
465
+ zYUiBYqy4xX97jtSL+ply2mKbURgm+Td8e53d3xcvvaWKmC9SQ9ZzeFnPl0h
466
+ j+EoOnd6HqOhK7D0nR6ivj0wg1/erdObOtxRhqdpfka4Zo3UhhGYDUVEFRV8
467
+ IgnDiq7IaxBwRoMFiqQH885oTVzKPRb7JHJGXgQfNMAL3YmWWJKZJ8JNvsYw
468
+ 5AtLeoDlgvKBpIulmqAX4d1rFGLfp3wxUCKcoGMYAXJnND2LQsynb0EW+kL5
469
+ JhJ8gRjlt0gJtBGxRMUSZ7CyJoZvMBKszX4oMLwFrCj2PAK61zDLJxLU9jU8
470
+ Zb+32Z8T/nnM2AaBQEp8bXGu36PCuqptrrhDnKi1kLeR7fRsHlZKhysTHg6R
471
+ UU17OhfeRMXIvEJk/7SpAzACsGleUGvqxkoJHuUEW5TtrnBHpQ1ZHiPKxAl8
472
+ 6uTaakQDifG8jstotpY4DIksqW3oY5YEWUFbokmpGC2MX1OliEQmiEqUKS1G
473
+ iioTWV8SUggeBTFGFAzNXIY5pD1aSjKH/lKpcOKMnFEqduiJwBktRUAuIoVV
474
+ HJ0zGinCIRr7SvTfxJL33U3/F0LC/k0sQ0b6gvcPnh/9KoVYEW3F7cHJZV/L
475
+ he+D8TX8qTRHtXDovvXm1/2D8UkQR9QLBPfxRne5WIcMb6hJDsCisHWgOQbj
476
+ F6fHr346HtesTu02aZ6anGV9AzzOCNfxdUaMbkV9jj3iCnHbBfbrlLYT7uv1
477
+ epgJT8A3kSCH4TK8iM8L/1gYOiMNSI5Sxr4HTJmK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z2oOHo0
494
+ SbI9JM/i7AxKelf5xXsLDqle2p60HP8Zrkl5Ob5Wdm+XYjBLVJ+2Wm1jW6JJ
495
+ qcxurl8z5feNVeuvvIKrNenKO/jha+C58mUsYOLRYIA+vXt/dHqMnBF6/ur0
496
+ 1cvn+tcRGgyAsXfYM0t8BN/1JomnYSw9zGGkpokhURLn/98xFMvxVBeRQA/4
497
+ VYyeTHVJCSUlJT15khnXaqmRH0v7hV2aTwp59usb1+vNTbWXem2n8g+Y5J4/
498
+ 3SKlVF0pm5B1et/+Aeg3Sog7GwAA
499
+ http_version:
500
+ recorded_at: Mon, 22 Apr 2013 13:03:57 GMT
501
+ - request:
502
+ method: post
503
+ uri: http://tinysong.com/?s=s
504
+ body:
505
+ encoding: US-ASCII
506
+ string: q[]=smoke%20on%20the%20water%20deep%20purple&q[]=0
507
+ headers:
508
+ Accept:
509
+ - '*/*; q=0.5, application/xml'
510
+ Accept-Encoding:
511
+ - gzip, deflate
512
+ Content-Length:
513
+ - '50'
514
+ Content-Type:
515
+ - application/x-www-form-urlencoded
516
+ User-Agent:
517
+ - Ruby
518
+ response:
519
+ status:
520
+ code: 200
521
+ message: OK
522
+ headers:
523
+ Server:
524
+ - richhickey
525
+ Date:
526
+ - Mon, 22 Apr 2013 13:03:57 GMT
527
+ Content-Type:
528
+ - text/html; charset=UTF-8
529
+ Content-Length:
530
+ - '594'
531
+ Connection:
532
+ - close
533
+ Set-Cookie:
534
+ - TinysongSessionID=8d1ba131d17ccb594f0e89a838ff8cb8; expires=Mon, 18-Apr-2016
535
+ 13:03:57 GMT; path=/
536
+ Cache-Control:
537
+ - max-age=300
538
+ Expires:
539
+ - Mon, 22 Apr 2013 13:08:57 GMT
540
+ Vary:
541
+ - Accept-Encoding
542
+ Content-Encoding:
543
+ - gzip
544
+ X-Hostname:
545
+ - rhl110
546
+ - rhl110
547
+ body:
548
+ encoding: ASCII-8BIT
549
+ string: !binary |-
550
+ H4sIAAAAAAAAA+WXyW7bMBCGX2WqQ5ECVazN8gLVhyIGfEhbwU7RiwCDkRlb
551
+ MLWUpLIgyLt3tFqynDa9Wa0OBjnkzPwz80mAn5WdDJkyVaDxOJvgHnxGhPjk
552
+ KZyKlMn1AydJQrmnQLA5YZ15ERw9TsqOgqAzpwy3pmmPDXtkqYIS7u9yd086
553
+ LKgdShMam1rEjmCkONp2EjoiIVF97zaVMo7w0ipzcLxBdtrwQAuGbRhO5EoY
554
+ eaqqFVytJHdqeKsUF+P9RkmW/4QKyYm/r5uBhymr1+2OlW1ZhfGeQhyB3FH4
555
+ QSTlmIIFrzgRLgOBc5ldUZqAm/KE0fZ93NUp/yTWZzhODNa4VwUrwmSNbrYK
556
+ 7e9UFZaLa13XwBuANbGHQyNbaaCqx419HSjDtCxraA57BFQluVPDWQL1LYKb
557
+ Cii4uA7u6Yf/gSvd0kx9Mu4TV5XkTg1nxtXVfO6C+33pXs/fRFKXwz4CZdiG
558
+ ObJtrUdAVZI7NZwZUCc+VIamjeFiRaIND36mFN7DDRF7PFgQzugTLGkYPP7L
559
+ HzLAXQO+oa1PRrrRJ/hKyZ0azgy+zymPes1R7lkGi/Jk+QjCmNN1wZLAGVQC
560
+ 2uaysfkEZk4QbkFwP6Np8EBvg8hn6YYKb+AL/AlCss02pfM6i3SZZD08IJB3
561
+ 9AseQHnrMMAGQn9bofJRyTN8JSHFPzzFO4DGkAqBmtDURkjSR9mu7TB0yYux
562
+ LyiKRNZBxGGt9rIlN19hml0sZFSkLkSiDTNw4hJOQqFMn5X47k5QqUx1/eXl
563
+ F+Hu80aZDQAA
564
+ http_version:
565
+ recorded_at: Mon, 22 Apr 2013 13:03:57 GMT
566
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,46 @@
1
+ describe Tinysong::Search do
2
+ use_vcr_cassette
3
+
4
+ describe "find" do
5
+ it "returns on song" do
6
+ song = Tinysong::Search.find("smoke on the water deep purple")
7
+ song.title.should eq("Smoke on the Water")
8
+ song.artist.should eq("Deep Purple")
9
+ song.id.should be_a(Fixnum)
10
+ song.id.should > 0
11
+ song.href.should match(%r{http://tinysong.com/\w+})
12
+ end
13
+
14
+ it "doesn't raise error if nothing is found" do
15
+ lambda {
16
+ Tinysong::Search.find("667a4af374347aaebc6d04d8572fbb85")
17
+ }.should_not raise_error
18
+ end
19
+ end
20
+
21
+ describe "all" do
22
+ it "returns a list of songs" do
23
+ songs = Tinysong::Search.all("smoke on the water deep purple")
24
+ songs.first.should be_a(Tinysong::Song)
25
+ end
26
+
27
+ it "limits the result" do
28
+ songs = Tinysong::Search.all("smoke on the water deep purple", limit: 0)
29
+ songs.length.should eq(0)
30
+
31
+ songs = Tinysong::Search.all("smoke on the water deep purple", limit: 1)
32
+ songs.length.should eq(1)
33
+ end
34
+
35
+ it "defaults to 5 results" do
36
+ songs = Tinysong::Search.all("smoke on the water deep purple")
37
+ songs.length.should eq(5)
38
+ end
39
+
40
+ it "doesn't raise error if nothing is found" do
41
+ lambda {
42
+ Tinysong::Search.all("667a4af374347aaebc6d04d8572fbb85")
43
+ }.should_not raise_error
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,18 @@
1
+ require "rspec"
2
+ require "webmock/rspec"
3
+ require "vcr"
4
+ require "tinysong"
5
+
6
+ RSpec.configure do |config|
7
+ config.mock_with :rspec
8
+ config.extend VCR::RSpec::Macros
9
+ end
10
+
11
+ VCR.configure do |c|
12
+ c.cassette_library_dir = "spec/fixtures/vcr_cassettes"
13
+ c.hook_into :webmock
14
+ c.default_cassette_options = {
15
+ record: :new_episodes
16
+ }
17
+ c.allow_http_connections_when_no_cassette = false
18
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tinysong/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tinysong"
8
+ spec.version = Tinysong::VERSION
9
+ spec.authors = ["Linus Oleander"]
10
+ spec.email = ["linus@oleander.nu"]
11
+ spec.description = %q{Unofficial ruby library for tinysong.com}
12
+ spec.summary = %q{This library scrapes tinysong.com, which means that there aren't any request limitations}
13
+ spec.homepage = "https://github.com/oleander/tinysong-rb"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency("rest-client")
25
+ spec.add_dependency("nokogiri")
26
+
27
+ spec.add_development_dependency("vcr")
28
+ spec.add_development_dependency("rspec")
29
+ spec.add_development_dependency("webmock", "~> 1.8.0")
30
+
31
+ spec.required_ruby_version = "~> 1.9.2"
32
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tinysong
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Linus Oleander
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-04-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rest-client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: vcr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.8.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.8.0
111
+ description: Unofficial ruby library for tinysong.com
112
+ email:
113
+ - linus@oleander.nu
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rspec
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - lib/tinysong.rb
125
+ - lib/tinysong/search.rb
126
+ - lib/tinysong/version.rb
127
+ - spec/fixtures/vcr_cassettes/Tinysong_Search.yml
128
+ - spec/search_spec.rb
129
+ - spec/spec_helper.rb
130
+ - tinysong.gemspec
131
+ homepage: https://github.com/oleander/tinysong-rb
132
+ licenses:
133
+ - MIT
134
+ metadata: {}
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ~>
142
+ - !ruby/object:Gem::Version
143
+ version: 1.9.2
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.0.0
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: This library scrapes tinysong.com, which means that there aren't any request
155
+ limitations
156
+ test_files:
157
+ - spec/fixtures/vcr_cassettes/Tinysong_Search.yml
158
+ - spec/search_spec.rb
159
+ - spec/spec_helper.rb