aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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())