From e2944615843065c08eccdef04122765dd3fc95b1 Mon Sep 17 00:00:00 2001 From: Flavio Date: Thu, 27 Sep 2012 11:52:24 +0200 Subject: [PATCH] Adapted to Youtube changes --- src/video.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video.cpp b/src/video.cpp index d414990..a7f6e5c 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -142,7 +142,7 @@ void Video::gotVideoInfo(QByteArray data) { QString definitionName = settings.value("definition").toString(); int definitionCode = VideoDefinition::getDefinitionCode(definitionName); - // qDebug() << "fmtUrlMap" << fmtUrlMap; + qDebug() << "fmtUrlMap" << fmtUrlMap; QStringList formatUrls = fmtUrlMap.split(",", QString::SkipEmptyParts); QHash urlMap; foreach(QString formatUrl, formatUrls) { @@ -152,6 +152,7 @@ void Video::gotVideoInfo(QByteArray data) { int format = -1; QString url; + QString sig; foreach(QString urlParam, urlParams) { if (urlParam.startsWith("itag=")) { int separator = urlParam.indexOf("="); @@ -160,10 +161,16 @@ void Video::gotVideoInfo(QByteArray data) { int separator = urlParam.indexOf("="); url = urlParam.mid(separator + 1); url = QByteArray::fromPercentEncoding(url.toUtf8()); + } else if (urlParam.startsWith("sig=")) { + int separator = urlParam.indexOf("="); + sig = urlParam.mid(separator + 1); + sig = QByteArray::fromPercentEncoding(sig.toUtf8()); } } if (format == -1 || url.isNull()) continue; + url += "&signature=" + sig; + if (format == definitionCode) { qDebug() << "Found format" << definitionCode; QUrl videoUrl = QUrl::fromEncoded(url.toUtf8(), QUrl::StrictMode); -- 2.39.5