跳转至

Search

搜索相关Api

/**
 * @brief 搜索类型枚举
 * */
enum class SearchType : unsigned {
    SONG = 0,         ///< 歌曲
    SINGER = 1,       ///< 歌手
    ALBUM = 2,        ///< 专辑
    SONG_LIST = 3,    ///< 歌单
    MV = 4,           ///< MV
    LYRIC = 7,        ///< 歌词
    USER = 8,         ///< 用户
    AUDIO_ALBUM = 15, ///< 节目专辑
    AUDIO = 18,       ///< 节目
};

function hotkey

获取搜索热词

Task< Result < nlohmann::json > > qqmusic::hotkey () 

Returns:

Json格式的搜索热词

Note:

异步函数, 返回Task


function keyword_complete

搜索词联想补全

Task< Result < nlohmann::json > > qqmusic::keyword_complete (
    std::string_view keyword
) 

Parameters:

  • keyword 当前搜索词

Returns:

带有高亮的补全结果

Note:

异步函数, 返回Task


快速搜索

Task< Result < nlohmann::json > > qqmusic::quick_search (
    std::string_view keyword
) 

Parameters:

  • keyword 搜索词

Returns:

Json格式搜索结果

Note:

异步函数, 返回Task


综合搜索

Task< Result < nlohmann::json > > qqmusic::general_search (
    std::string_view keyword,
    unsigned num=15,
    unsigned page=1,
    bool highlight=true
) 

Parameters:

  • keyword 搜索词
  • num 每页结果数, 默认15
  • page 页数, 默认1
  • highlight 是否高亮, 默认true

Returns:

Json格式搜索结果

Note:

异步函数, 返回Task


function search_by_type

按类型搜索

Task< Result < nlohmann::json > > qqmusic::search_by_type (
    std::string_view keyword,
    SearchType type=SearchType::SONG,
    unsigned num_per_page=10,
    unsigned page=1,
    bool highlight=true
) 

Parameters:

  • keybord 搜索词
  • type 搜索类型
  • num_per_page 每页结果数
  • page 页数

Returns:

Json格式搜索结果

Note:

异步函数, 返回Task