doubapi 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/doubapi/version.rb +1 -1
- data/lib/doubapi.rb +9 -2
- data/lib/test.rb +2 -2
- metadata +1 -1
data/lib/doubapi/version.rb
CHANGED
data/lib/doubapi.rb
CHANGED
@@ -41,7 +41,7 @@ module Doubapi
|
|
41
41
|
#use Douban API
|
42
42
|
Event = Struct.new :title, :when, :where, :what,:link,:poster_mobile,:bar_icon
|
43
43
|
#release_date is in the format of YY-MM-DD
|
44
|
-
Album = Struct.new :author, :title, :release_date, :link,:cover_thumbnail,:publisher,:mobile_site
|
44
|
+
Album = Struct.new :author, :title, :release_date, :link,:cover_thumbnail,:cover_big,:publisher,:mobile_site
|
45
45
|
|
46
46
|
#input:{key => "all/singer_name", :location => "shanghai", :start_index => 16,:max_result => 15}
|
47
47
|
#return total number of events satisfying the search criterion
|
@@ -201,6 +201,13 @@ def search_albums_of h
|
|
201
201
|
#link - pc web
|
202
202
|
link = entry.at_xpath(".//link[@rel='alternate']")["href"]
|
203
203
|
cover_thumnail = entry.at_xpath(".//link[@rel='image']")["href"]
|
204
|
+
|
205
|
+
#cover big
|
206
|
+
#example:
|
207
|
+
#thumbnail http://img1.douban.com/spic/s1461123.jpg
|
208
|
+
#big http://img1.douban.com/lpic/s1461123.jpg
|
209
|
+
cover_big = cover_thumnail.gsub("spic","lpic");
|
210
|
+
|
204
211
|
#publisher
|
205
212
|
pubItem = entry.at_xpath(".//attribute[@name='publisher']")
|
206
213
|
publisher = if pubItem.nil? then "unknow" else pubItem.text end
|
@@ -212,7 +219,7 @@ def search_albums_of h
|
|
212
219
|
formated_release_day = formate_release_date(release_date)
|
213
220
|
#check the release date
|
214
221
|
if compare_date release_date, after_date
|
215
|
-
albums << Doubapi::Album.new(author, title, formated_release_day, link, cover_thumnail,publisher,mobile_site)
|
222
|
+
albums << Doubapi::Album.new(author, title, formated_release_day, link, cover_thumnail,cover_big ,publisher,mobile_site)
|
216
223
|
end
|
217
224
|
end
|
218
225
|
#improve ME
|
data/lib/test.rb
CHANGED