video->setDescription(desc);
const auto thumbs = i["videoThumbnails"].toArray();
- for (const auto &thumbObj : thumbs) {
- QString url = thumbObj["url"].toString();
- int width = thumbObj["width"].toInt();
- if (width >= 336)
- video->setLargeThumbnailUrl(url);
- else if (width >= 246)
- video->setMediumThumbnailUrl(url);
- else if (width >= 168)
- video->setThumbnailUrl(url);
+ for (const auto &t : thumbs) {
+ video->addThumb(t["width"].toInt(), t["height"].toInt(),
+ t["url"].toString());
}
int views = i["viewCount"].toInt();
emit gotVideos(videos);
emit finished(videos.size());
})
- .onError([this, &js, max, startIndex](auto &msg) {
+ .onError([this, max, startIndex](auto &msg) {
static int retries = 0;
if (retries < 3) {
qDebug() << "Retrying...";
- auto nam = js.getEngine().networkAccessManager();
- nam->clearAccessCache();
- nam->setCookieJar(new QNetworkCookieJar());
QTimer::singleShot(0, this,
[this, max, startIndex] { loadVideos(max, startIndex); });
retries++;