diff options
-rw-r--r-- | src/plugins/Youtube.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 6923d04..b50939e 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -35,6 +35,14 @@ namespace QuickMedia { std::string thumbnail_url = "https://img.youtube.com/vi/" + video_id_str + "/hqdefault.jpg"; + const char *date = nullptr; + const Json::Value &published_time_text_json = video_renderer_json["publishedTimeText"]; + if(published_time_text_json.isObject()) { + const Json::Value &text_json = published_time_text_json["simpleText"]; + if(text_json.isString()) + date = text_json.asCString(); + } + const char *title = nullptr; const Json::Value &title_json = video_renderer_json["title"]; if(title_json.isObject()) { @@ -53,6 +61,11 @@ namespace QuickMedia { return nullptr; auto body_item = std::make_unique<BodyItem>(title); + /* TODO: Make date a different color */ + if(date) { + body_item->title += '\n'; + body_item->title += date; + } body_item->url = "https://www.youtube.com/watch?v=" + video_id_str; body_item->thumbnail_url = std::move(thumbnail_url); added_videos.insert(video_id_str); |