X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fytsinglevideosource.cpp;h=09936cad8f1a541deb831f31331c4e45f351219c;hb=8cea1b650a0122369e8a3d60da1f263767b67614;hp=b4f4d308943341e810a5862f2650b43e77134d73;hpb=7cdd5bd476021ec84d54c4ec5be02280e1e9e548;p=minitube diff --git a/src/ytsinglevideosource.cpp b/src/ytsinglevideosource.cpp index b4f4d30..09936ca 100644 --- a/src/ytsinglevideosource.cpp +++ b/src/ytsinglevideosource.cpp @@ -19,72 +19,96 @@ along with Minitube. If not, see . $END_LICENSE */ #include "ytsinglevideosource.h" -#include -#include "networkaccess.h" +#include "http.h" +#include "httputils.h" #include "video.h" -#include "ytfeedreader.h" -namespace The { -NetworkAccess* http(); -} +#include "yt3.h" +#include "yt3listparser.h" -YTSingleVideoSource::YTSingleVideoSource(QObject *parent) : VideoSource(parent) { - skip = 0; - max = 0; -} +YTSingleVideoSource::YTSingleVideoSource(QObject *parent) + : PaginatedVideoSource(parent), video(nullptr), startIndex(0), max(0) {} -void YTSingleVideoSource::loadVideos(int max, int skip) { +void YTSingleVideoSource::loadVideos(int max, int startIndex) { aborted = false; - this->skip = skip; + this->startIndex = startIndex; this->max = max; - QString s; - if (skip == 1) s = "http://gdata.youtube.com/feeds/api/videos/" + videoId; - else s = QString("http://gdata.youtube.com/feeds/api/videos/%1/related").arg(videoId); - QUrl url(s); - url.addQueryItem("v", "2"); - - if (skip != 1) { - url.addQueryItem("max-results", QString::number(max)); - url.addQueryItem("start-index", QString::number(skip-1)); + QUrl url; + + if (startIndex == 1) { + if (video) { + QVector