Skip to content

Commit

Permalink
[xiami] support xiami widget
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterDing committed Aug 1, 2015
1 parent 54478dc commit c372e1a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ xm d http://www.xiami.com/chart/index/c/2?spm=a1z1s.2943549.6827465.6.VrEAoY
xm d http://www.xiami.com/genre/detail/gid/2?spm=a1z1s.3057857.6850221.1.g9ySan
xm d http://www.xiami.com/genre/detail/sid/2970?spm=a1z1s.3057857.6850221.4.pkepgt
# 下载 widget (虾米播播)
xm d http://www.xiami.com/widget/player-multi?uid=4350663&sid=1774531852,378713,3294421,1771778464,378728,378717,378727,1773346501,&width=990&height=346&mainColor=e29833&backColor=60362a&widget_from=4350663
# 下载落网期刊
# 分析落网期刊的音乐后,在虾米上搜索并下载
xm d http://www.luoo.net/music/706
Expand Down
13 changes: 13 additions & 0 deletions xiami.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,12 @@ def get_artist_id(url):
elif 'luoo.net' in url:
self.hack_luoo(url)

elif 'sid=' in url:
_mod = re.search(r'sid=([\d+,]+\d)', url)
if _mod:
song_ids = _mod.group(1).split(',')
self.download_songs(song_ids)

else:
print(s % (2, 91, u' 请正确输入虾米网址.'))

Expand Down Expand Up @@ -619,6 +625,13 @@ def download_song(self):
#self.song_infos = [song_info]
self.download(songs)

def download_songs(self, song_ids):
for song_id in song_ids:
self.song_id = song_id
songs = self.get_song(self.song_id)
self.download(songs)


def download_album(self):
songs = self.get_songs(self.album_id)
song = songs[0]
Expand Down

0 comments on commit c372e1a

Please sign in to comment.