#include "http.h"
#include "httputils.h"
-#include "videoapi.h"
#include "ivchannelsource.h"
+#include "videoapi.h"
+#include "ytjschannelsource.h"
ChannelAggregator::ChannelAggregator(QObject *parent)
: QObject(parent), unwatchedCount(-1), running(false), stopped(false), currentChannel(0) {
void ChannelAggregator::checkWebPage(YTChannel *channel) {
currentChannel = channel;
- QString url = "https://www.youtube.com/channel/" + channel->getChannelId() + "/videos";
+
+ QString channelId = channel->getChannelId();
+ QString url;
+ if (channelId.startsWith("UC") && !channelId.contains(' ')) {
+ url = "https://www.youtube.com/channel/" + channelId + "/videos";
+ } else {
+ url = "https://www.youtube.com/user/" + channelId + "/videos";
+ }
+
QObject *reply = HttpUtils::yt().get(url);
connect(reply, SIGNAL(data(QByteArray)), SLOT(parseWebPage(QByteArray)));
connect(videoSource, SIGNAL(gotVideos(QVector<Video *>)),
SLOT(videosLoaded(QVector<Video *>)));
videoSource->loadVideos(50, 1);
+ } else if (VideoAPI::impl() == VideoAPI::JS) {
+ auto *videoSource = new YTJSChannelSource(params);
+ connect(videoSource, SIGNAL(gotVideos(QVector<Video *>)),
+ SLOT(videosLoaded(QVector<Video *>)));
+ videoSource->loadVideos(50, 1);
}
channel->updateChecked();