예제 #1
0
def song_search(keyword):
    """
    搜索音乐
        /netease/song/keyword/search
    :return:
    """
    try:
        if keyword is None or keyword is '' or len(keyword) is 0:
            return Response.error(keyword, message='keyword can not be null.')

        return Response.success(MusicooService.song_search(keyword).to_json())
    except Exception as e:
        log.error('[Musicoo] ip: {};\t\terror: {}'.format(request.remote_addr, e))
        return Response.error()
예제 #2
0
def song(keyword):
    """
    url,歌词,detail
        /netease/song/1379444316
        /netease/song/差不多姑娘
    :param keyword:
    :return:
    """
    try:
        if keyword is None or keyword is '' or len(keyword) is 0:
            return Response.error(keyword, message='keyword can not be null.')

        return Response.success(MusicooService.song(keyword).to_json())
    except Exception as e:
        log.error('[Musicoo] ip: {};\t\terror: {}'.format(request.remote_addr, e))
        return Response.error()
예제 #3
0
def songs_search(keyword, offset, limit):
    """
    搜索音乐们
        /netease/songs/keyword/search
    :param keyword 关键字
    :param offset 页数
    :param limit 数量
    :return:
    """
    try:
        if keyword is None or keyword is '' or len(keyword) is 0:
            return Response.error(keyword, message='keyword can not be null.')

        return Response.success(MusicooService.songs_search(keyword, offset=offset, limit=limit))
    except Exception as e:
        log.error('[Musicoo] ip: {};\t\terror: {}'.format(request.remote_addr, e))
        return Response.error()
예제 #4
0
def song_lyric(song_id):
    """
    获取音乐歌词
        /netease/song/1379444316/lyric
    :param song_id:
    :return:
    """
    try:
        if song_id is None or song_id is '' or len(song_id) is 0:
            return Response.error(song_id, message='song_id can not be null.')
        if song_id.isdigit() is False:
            return Response.error(song_id, message='song_id must be digit.')

        return Response.success(MusicooService.song_lyric(song_id).to_json())
    except Exception as e:
        log.error('[Musicoo] ip: {};\t\terror: {}'.format(request.remote_addr, e))
        return Response.error()
예제 #5
0
def playlist_songs(playlist_id=''):
    """
    获取歌单列表,音乐 id、音乐名等等
        /netease/playlist/3778678/songs
    :param playlist_id: eg 3778678
    :return:
    """
    try:
        if playlist_id is None or playlist_id is '' or len(playlist_id) is 0:
            return Response.error(playlist_id,
                                  message='playlist_id can not be null.')
        if playlist_id.isdigit() is False:
            return Response.error(playlist_id,
                                  message='song_id must be digit.')

        return Response.success(
            MusicooService.playlist_songs(playlist_id).to_json())
    except Exception as e:
        log.error('[Musicoo] ip: {};\t\terror: {}'.format(
            request.remote_addr, e))
        return Response.error()