文档中心 > API类目 > 曲库开放平台歌曲API

xiami.content.music.info.query (搜索音乐)

(批量)获取歌曲信息

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
search_terms SearchTermsDTO 可选 搜索条件 key支持songName/singerName/copyrightStatus/publishStatus/keyword
  • └ value
  • String
  • 可选
  • 小幸运
  • 搜索的value。songName:歌曲名称;singerName:演唱者名称;lyric:歌词文本(只匹配前50字符); copyrightStatus:版权状态 0下架/1上架;publishStatus:发布状态 0未发布/1发布; keyword:关键字搜索(与songName/singerName互斥); lyric:歌词搜索,限制字符数50
  • └ key
  • String
  • 可选
  • songName
  • 搜索key:songName/singerName/lyric/copyrightStatus/publishStatus/keyword/lyric
tag_optional SongCatsSearchDTO 可选 tag搜索条件,tag尽量不要超过50个
  • └ relation
  • Number
  • 可选
  • 1
  • 标签类目间的关系查询 1 and 2:or
  • cat_tag_codes
  • SongCatTagDTO []
  • 可选
  • 标签组列表
  • └ tag_codes
  • String []
  • 可选
  • tag code列表
  • └ relation
  • Number
  • 可选
  • 1
  • tag间的关系查询 1 and 2:or
order_by Number 可选 1 排序,默认按照最新排序 1最新 2本周最热 3本月最热
page PagingVO 可选 分页信息
  • └ page_size
  • Number
  • 可选
  • 20
  • 每页数量
  • └ page
  • Number
  • 可选
  • 1
  • 页码

响应参数

名称 类型 示例值 描述
music_dto_page Page 音乐信息
  • data
  • MusicDTO []
  • 音乐列表
  • └ song_name
  • String
  • 派大星
  • 歌曲名
  • singers
  • ArtistDTO []
  • 演唱者
  • └ area
  • String
  • United States of America 美国
  • 地区
  • └ gender
  • String
  • M
  • 性别
  • └ alias
  • String
  • 张三
  • 别名
  • └ artist_name
  • String
  • PO8
  • 艺人名
  • └ artist_logo
  • String
  • https://pic.xiami.net/musician-avatar/05627c31d37f7844ddd1e36fde6212a8/8ca3fb8850722c1a6e575c8215db6ad4-2688x2688.jpg
  • 艺人封面
  • └ artist_id
  • Number
  • 910507425
  • 艺人id
  • album
  • AlbumDTO
  • 专辑
  • └ album_logo
  • String
  • https://pic.xiami.net/images/album/img25/910507425/21003758381470226579.jpg
  • 专辑封面
  • └ album_name
  • String
  • 回到老学校
  • 专辑名
  • └ company_id
  • Number
  • 1706
  • 厂牌id
  • └ sub_name
  • String
  • Back to the old school
  • 副标题
  • └ gmt_publish
  • Date
  • 1470153600000
  • 发布时间
  • └ album_id
  • Number
  • 2100375838
  • 专辑id
  • └ language
  • String
  • 国语
  • 语言
  • └ show_status
  • Number
  • 1
  • 展示状态
  • tags
  • TagLink []
  • 标签
  • └ code
  • String
  • cat_2_1141_4_16417909
  • 标签code
  • └ name_cn
  • String
  • 另类说唱
  • 标签名
  • └ id
  • Number
  • 16417909
  • 标签id
  • └ cover_url
  • String
  • https://pic.xiami.net/images/album/img25/910507425/21003758381470226579.jpg
  • 封面地址
  • └ duration
  • Number
  • 214000
  • 时长
  • └ waveform_url
  • String
  • https://img.xiami.net/wave/1776298833_1628375853812.txt
  • 波形图地址
  • └ copyright_status
  • Number
  • 1
  • 1-版权上架, 0-版权下架
  • audios
  • AudioDTO []
  • 音频列表
  • └ duration
  • Number
  • 214000
  • 时长
  • └ listen_url
  • String
  • https://m320.xiami.net/425/910507425/2100373543/1776298833_60452555_h.mp3?auth_key=1650855600-0-0-30f0abe02251b78aff7bddeafd69f91e
  • 试听文件地址
  • └ rate
  • Number
  • 320
  • 码率
  • └ file_size
  • Number
  • 8588266
  • 文件大小
  • └ audio_id
  • Number
  • 69651445
  • 音频id
  • └ format
  • String
  • mp3
  • 格式
  • └ bits
  • Number
  • 0
  • 位数
  • └ sample_rate
  • Number
  • 44100
  • 采样率
  • └ quality
  • Number
  • 2
  • 音质
  • └ song_sub_name
  • String
  • 副标题
  • 副标题
  • └ song_id
  • Number
  • 1776298833
  • 歌曲id
  • lyrics
  • LyricDTO []
  • 歌词
  • └ lyric_id
  • Number
  • 10200596
  • 歌词id
  • └ type
  • Number
  • 2
  • 类型
  • └ lyric_url
  • String
  • https://img.xiami.net/lyric/0/0_14697171111506.lrc
  • 歌词地址
  • └ music_type
  • Number
  • 1
  • 音乐类型1完整版2剪辑版
  • └ publish_status
  • Number
  • 1
  • 发布状态
  • └ deleted_status
  • Number
  • 0
  • 是否删除
  • └ count
  • Number
  • 339
  • 数量
  • paging_vo
  • PagingVO
  • 分页信息
  • └ pages
  • Number
  • 17
  • 总页数
  • └ count
  • Number
  • 339
  • 总数
  • └ page_size
  • Number
  • 20
  • 每页数量
  • └ page
  • Number
  • 1
  • 页码
result_code ResultCode 结果code
  • └ msg
  • String
  • success
  • 消息
  • └ code
  • Number
  • 0
  • code
  • └ success
  • Boolean
  • true
  • 是否成功

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
XiamiContentMusicInfoQueryRequest req = new XiamiContentMusicInfoQueryRequest();
XiamiContentMusicInfoQueryRequest.SearchTermsDTO obj1 = new XiamiContentMusicInfoQueryRequest.SearchTermsDTO();
obj1.setValue("小幸运");
obj1.setKey("songName");
req.setSearchTerms(obj1);
XiamiContentMusicInfoQueryRequest.SongCatsSearchDTO obj2 = new XiamiContentMusicInfoQueryRequest.SongCatsSearchDTO();
obj2.setRelation(1L);
List<XiamiContentMusicInfoQueryRequest.SongCatTagDTO> list4 = new ArrayList<XiamiContentMusicInfoQueryRequest.SongCatTagDTO>();
XiamiContentMusicInfoQueryRequest.SongCatTagDTO obj5 = new XiamiContentMusicInfoQueryRequest.SongCatTagDTO();
list4.add(obj5);
obj5.setTagCodes("");
obj5.setRelation(1L);
obj2.setCatTagCodes(list4);
req.setTagOptional(obj2);
req.setOrderBy(1L);
XiamiContentMusicInfoQueryRequest.PagingVO obj6 = new XiamiContentMusicInfoQueryRequest.PagingVO();
obj6.setPageSize(20L);
obj6.setPage(1L);
req.setPage(obj6);
XiamiContentMusicInfoQueryResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<xiami_content_music_info_query_response>
    <music_dto_page>
        <data>
            <music_d_t_o>
                <song_name>派大星</song_name>
                <singers>
                    <artist_d_t_o>
                        <area>United States of America 美国</area>
                        <gender>M</gender>
                        <alias>张三</alias>
                        <artist_name>PO8</artist_name>
                        <artist_logo>https://pic.xiami.net/musician-avatar/05627c31d37f7844ddd1e36fde6212a8/8ca3fb8850722c1a6e575c8215db6ad4-2688x2688.jpg</artist_logo>
                        <artist_id>910507425</artist_id>
                    </artist_d_t_o>
                </singers>
                <album>
                    <album_logo>https://pic.xiami.net/images/album/img25/910507425/21003758381470226579.jpg</album_logo>
                    <album_name>回到老学校</album_name>
                    <company_id>1706</company_id>
                    <sub_name>Back to the old school</sub_name>
                    <gmt_publish>1470153600000</gmt_publish>
                    <album_id>2100375838</album_id>
                    <language>国语</language>
                </album>
                <show_status>1</show_status>
                <tags>
                    <tag_link>
                        <code>cat_2_1141_4_16417909</code>
                        <name_cn>另类说唱</name_cn>
                        <id>16417909</id>
                    </tag_link>
                </tags>
                <cover_url>https://pic.xiami.net/images/album/img25/910507425/21003758381470226579.jpg</cover_url>
                <duration>214000</duration>
                <waveform_url>https://img.xiami.net/wave/1776298833_1628375853812.txt</waveform_url>
                <copyright_status>1</copyright_status>
                <audios>
                    <audio_d_t_o>
                        <duration>214000</duration>
                        <listen_url>https://m320.xiami.net/425/910507425/2100373543/1776298833_60452555_h.mp3?auth_key=1650855600-0-0-30f0abe02251b78aff7bddeafd69f91e</listen_url>
                        <rate>320</rate>
                        <file_size>8588266</file_size>
                        <audio_id>69651445</audio_id>
                        <format>mp3</format>
                        <bits>0</bits>
                        <sample_rate>44100</sample_rate>
                        <quality>2</quality>
                    </audio_d_t_o>
                </audios>
                <song_sub_name>副标题</song_sub_name>
                <song_id>1776298833</song_id>
                <lyrics>
                    <lyric_d_t_o>
                        <lyric_id>10200596</lyric_id>
                        <type>2</type>
                        <lyric_url>https://img.xiami.net/lyric/0/0_14697171111506.lrc</lyric_url>
                    </lyric_d_t_o>
                </lyrics>
                <music_type>1</music_type>
                <publish_status>1</publish_status>
                <deleted_status>0</deleted_status>
            </music_d_t_o>
        </data>
        <count>339</count>
        <paging_vo>
            <pages>17</pages>
            <count>339</count>
            <page_size>20</page_size>
            <page>1</page>
        </paging_vo>
    </music_dto_page>
    <result_code>
        <msg>success</msg>
        <code>0</code>
        <success>true</success>
    </result_code>
</xiami_content_music_info_query_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部