aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-06-11 07:10:13 +0200
committerdec05eba <dec05eba@protonmail.com>2021-06-11 07:10:13 +0200
commit63ceee7552487a6111f9bef460448f0bc3958607 (patch)
tree366df41649e87afdf67f33c4dd0f3f26f6ad45b8 /src/plugins
parent8ad3f9ab8cc7029eb5db937e229d2a37b51a3462 (diff)
Fix youtube live streams (but they are slow...), fix youtube title spaces
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Youtube.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index d891ae3..8575d07 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -1834,6 +1834,11 @@ namespace QuickMedia {
}
std::string YoutubeVideoPage::get_video_url(int max_height, bool &has_embedded_audio) {
+ if(!hls_manifest_url.empty()) {
+ has_embedded_audio = true;
+ return hls_manifest_url;
+ }
+
if(video_formats.empty()) {
has_embedded_audio = true;
return "";
@@ -1858,6 +1863,7 @@ namespace QuickMedia {
}
PluginResult YoutubeVideoPage::load(std::string &title, std::string &channel_url) {
+ hls_manifest_url.clear();
video_formats.clear();
audio_formats.clear();
@@ -1898,16 +1904,23 @@ namespace QuickMedia {
if(!streaming_data_json.isObject())
return PluginResult::ERR;
- parse_formats(streaming_data_json);
-
- if(video_formats.empty() && audio_formats.empty())
- return PluginResult::ERR;
+ // TODO: Verify if this always works (what about copyrighted live streams?), also what about choosing video quality for live stream?
+ const Json::Value &hls_manifest_url_json = streaming_data_json["hlsManifestUrl"];
+ if(hls_manifest_url_json.isString()) {
+ hls_manifest_url = hls_manifest_url_json.asString();
+ } else {
+ parse_formats(streaming_data_json);
+ if(video_formats.empty() && audio_formats.empty())
+ return PluginResult::ERR;
+ }
const Json::Value &video_details_json = json_root["videoDetails"];
if(video_details_json.isObject()) {
const Json::Value &title_json = video_details_json["title"];
- if(title_json.isString())
+ if(title_json.isString()) {
title = title_json.asString();
+ string_replace_all(title, '+', ' ');
+ }
const Json::Value &channel_id_json = video_details_json["channelId"];
if(channel_id_json.isString())