From bdf80a6eda761ce1f717d5e6ea583d8eb59eb7ae Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Tue, 8 Sep 2020 17:27:35 +0200 Subject: [PATCH] handle user names --- src/channelaggregator.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/channelaggregator.cpp b/src/channelaggregator.cpp index af0d871a..2fcf42b5 100644 --- a/src/channelaggregator.cpp +++ b/src/channelaggregator.cpp @@ -101,7 +101,15 @@ void ChannelAggregator::processNextChannel() { 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)));