X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fytsinglevideosource.cpp;h=09936cad8f1a541deb831f31331c4e45f351219c;hb=8cea1b650a0122369e8a3d60da1f263767b67614;hp=05e5a327db238eae33b1654fb10c170898cfee8b;hpb=ce2a2ef756f5a0de914b05de10eba68549dfe5bd;p=minitube
diff --git a/src/ytsinglevideosource.cpp b/src/ytsinglevideosource.cpp
index 05e5a32..09936ca 100644
--- a/src/ytsinglevideosource.cpp
+++ b/src/ytsinglevideosource.cpp
@@ -19,81 +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);
-#if QT_VERSION >= 0x050000
-{
- QUrl &u = url;
- QUrlQuery url;
-#endif
- 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