def baidu_download_album(aid, output_dir='.', merge=True, info_only=False):
    html = get_html(('http://music.baidu.com/album/%s' % aid), faker=True)
    album_name = r1('<h2 class="album-name">(.+?)<\\/h2>', html)
    artist = r1('<span class="author_list" title="(.+?)">', html)
    output_dir = ('%s/%s - %s' % (output_dir, artist, album_name))
    ids = json.loads(r1('<span class="album-add" data-adddata=\\\'(.+?)\\\'>', html).replace('&quot', '').replace(';', '"'))['ids']
    track_nr = 1
    for id in ids:
        song_data = baidu_get_song_data(id)
        song_url = baidu_get_song_url(song_data)
        song_title = baidu_get_song_title(song_data)
        song_lrc = baidu_get_song_lyric(song_data)
        file_name = ('%02d.%s' % (track_nr, song_title))
        (type, ext, size) = url_info(song_url, faker=True)
        print_info(site_info, song_title, type, size)
        if (not info_only):
            download_urls([song_url], file_name, ext, size, output_dir, merge=merge, faker=True)
        if song_lrc:
            (type, ext, size) = url_info(song_lrc, faker=True)
            print_info(site_info, song_title, type, size)
            if (not info_only):
                download_urls([song_lrc], file_name, ext, size, output_dir, faker=True)
        track_nr += 1
def baidu_download_album(aid, output_dir='.', merge=True, info_only=False):
    html = get_html(('http://music.baidu.com/album/%s' % aid), faker=True)
    album_name = r1('<h2 class="album-name">(.+?)<\\/h2>', html)
    artist = r1('<span class="author_list" title="(.+?)">', html)
    output_dir = ('%s/%s - %s' % (output_dir, artist, album_name))
    ids = json.loads(r1('<span class="album-add" data-adddata=\\\'(.+?)\\\'>', html).replace('&quot', ).replace(';', '"'))['ids']
    track_nr = 1
    for id in ids:
        song_data = baidu_get_song_data(id)
        song_url = baidu_get_song_url(song_data)
        song_title = baidu_get_song_title(song_data)
        song_lrc = baidu_get_song_lyric(song_data)
        file_name = ('%02d.%s' % (track_nr, song_title))
        (type, ext, size) = url_info(song_url, faker=True)
        print_info(site_info, song_title, type, size)
        if (not info_only):
            download_urls([song_url], file_name, ext, size, output_dir, merge=merge, faker=True)
        if song_lrc:
            (type, ext, size) = url_info(song_lrc, faker=True)
            print_info(site_info, song_title, type, size)
            if (not info_only):
                download_urls([song_lrc], file_name, ext, size, output_dir, faker=True)
        track_nr += 1