diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Soundcloud.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/Soundcloud.cpp b/src/plugins/Soundcloud.cpp index cfb6011..37538ed 100644 --- a/src/plugins/Soundcloud.cpp +++ b/src/plugins/Soundcloud.cpp @@ -284,4 +284,21 @@ namespace QuickMedia { if(result != DownloadResult::OK) return download_result_to_plugin_result(result); return parse_user_page(json_root, result_items, next_href); } + + std::string SoundcloudAudioPage::url_get_playable_url(const std::string &url) { + std::string query_url = url + "?client_id=" + client_id; + + Json::Value json_root; + DownloadResult result = download_json(json_root, query_url, {}, true); + if(result != DownloadResult::OK) return url; + + if(!json_root.isObject()) + return url; + + const Json::Value &url_json = json_root["url"]; + if(!url_json.isString()) + return url; + + return url_json.asString(); + } }
\ No newline at end of file |