1 #include "ytjschannel.h"
5 YTJSChannel::YTJSChannel(const QString &id, QObject *parent) : QObject(parent) {
9 void YTJSChannel::load(const QString &channelId) {
11 .callFunction(new JSResult(this), "channelInfo", {channelId})
12 .onJson([this](auto &doc) {
13 auto obj = doc.object();
15 displayName = obj["author"].toString();
16 description = obj["description"].toString();
18 const auto thumbs = obj["authorThumbnails"].toArray();
19 int maxFoundWidth = 0;
20 for (const auto &thumbObj : thumbs) {
21 int width = thumbObj["width"].toInt();
22 if (width > maxFoundWidth) {
23 maxFoundWidth = width;
24 QString url = thumbObj["url"].toString();
31 .onError([this](auto &msg) { emit error(msg); });