diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-09-03 03:54:00 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-09-03 03:54:00 +0200 |
commit | 3f0421bea6b37d81d2d66c001b0fac2df91dd702 (patch) | |
tree | 560faf05481ba106aec6c79d478d018d02385c52 /src/plugins | |
parent | bab24cdda37e93bf87e487d22056361efaf90d50 (diff) |
Show youtube play fail reason in notification, more items below correct width!
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Youtube.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 34fd250..d308346 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -2321,7 +2321,7 @@ namespace QuickMedia { } } - PluginResult YoutubeVideoPage::parse_video_response(const Json::Value &json_root, std::string &title, std::string &channel_url, std::vector<MediaChapter> &chapters) { + PluginResult YoutubeVideoPage::parse_video_response(const Json::Value &json_root, std::string &title, std::string &channel_url, std::vector<MediaChapter> &chapters, std::string &err_str) { livestream_url.clear(); video_formats.clear(); audio_formats.clear(); @@ -2338,6 +2338,8 @@ namespace QuickMedia { const Json::Value &status_json = playability_status_json["status"]; if(status_json.isString() && (strcmp(status_json.asCString(), "UNPLAYABLE") == 0 || strcmp(status_json.asCString(), "LOGIN_REQUIRED") == 0)) { const Json::Value &reason_json = playability_status_json["reason"]; + if(reason_json.isString()) + err_str = reason_json.asString(); fprintf(stderr, "Unable to play video, status: %s, reason: %s\n", status_json.asCString(), reason_json.isString() ? reason_json.asCString() : "Unknown"); return PluginResult::ERR; } @@ -2432,7 +2434,7 @@ namespace QuickMedia { return PluginResult::OK; } - PluginResult YoutubeVideoPage::load(std::string &title, std::string &channel_url, std::vector<MediaChapter> &chapters) { + PluginResult YoutubeVideoPage::load(std::string &title, std::string &channel_url, std::vector<MediaChapter> &chapters, std::string &err_str) { livestream_url.clear(); video_formats.clear(); audio_formats.clear(); @@ -2479,7 +2481,7 @@ R"END( DownloadResult download_result = download_json(json_root, "https://www.youtube.com/youtubei/v1/player?key=" + api_key + "&gl=US&hl=en", additional_args, true); if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result); - return parse_video_response(json_root, title, channel_url, chapters); + return parse_video_response(json_root, title, channel_url, chapters, err_str); } void YoutubeVideoPage::mark_watched() { |