From d137dcfa6dd248ffa94e58e7aef4487682bc12dc Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 19 Jun 2021 14:24:14 +0200 Subject: youtube: fix description timestamp incorrectly including xx as a timestamp --- src/NetUtils.cpp | 3 +++ src/plugins/Youtube.cpp | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/NetUtils.cpp b/src/NetUtils.cpp index 977bbbf..d6b6cf2 100644 --- a/src/NetUtils.cpp +++ b/src/NetUtils.cpp @@ -110,6 +110,9 @@ namespace QuickMedia { } else { i += 1; } + } else if(c == '+') { + result += ' '; + i += 1; } else { result += c; i += 1; diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 11ff7fa..2be4f8d 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -2064,8 +2064,6 @@ R"END( return (hours * 60 * 60) + (minutes * 60) + seconds; if(sscanf(timestamp, "%d:%d", &minutes, &seconds) == 2) return (minutes * 60) + seconds; - if(sscanf(timestamp, "%d", &seconds) == 1) - return seconds; return -1; } @@ -2147,10 +2145,8 @@ R"END( 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()) @@ -2159,7 +2155,6 @@ R"END( const Json::Value &description_json = video_details_json["shortDescription"]; if(description_json.isString()) { std::string description = description_json.asString(); - string_replace_all(description, '+', ' '); chapters = youtube_description_extract_chapters(description); } } -- cgit v1.2.3