6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/xmfun/util/url_parser.rb', line 6
def self.parse(url)
if uri? url
url_array = url.split("//").last.split(/(\/|\?)/)
type, id = url_array[2], url_array[4]
case type
when "album" then "http://www.xiami.com/song/playlist/id/#{id}/type/1"
when "artist" then "http://www.xiami.com/song/playlist/id/#{id}/type/2"
when "collect" then "http://www.xiami.com/song/playlist/id/#{id}/type/3"
when "song" then "http://www.xiami.com/song/playlist/id/#{id}/object_name/default/object_id/0"
else ""
end
else
false
end
end
|