From c161760670d85095e46279b4e2ad2bcb6214f73c Mon Sep 17 00:00:00 2001 From: FlatTV Date: Sun, 2 Mar 2014 12:15:55 +0100 Subject: [PATCH] cYTFeedParser: Fix decodeVideoInfo() --- src/system/ytparser.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index fe5b6870b..7e7622757 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -406,7 +406,7 @@ bool cYTFeedParser::decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo) std::string infofile = thumbnail_dir; infofile += "/"; infofile += vinfo.id; - infofile += ".txt" + infofile += ".txt"; saveToFile(infofile.c_str(), answer); #endif if(answer.find("token=") == std::string::npos) @@ -440,7 +440,17 @@ bool cYTFeedParser::decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo) #endif cYTVideoUrl yurl; yurl.url = smap["url"]; - yurl.sig = smap["sig"]; + + std::string::size_type ptr = smap["url"].find("signature="); + if (ptr != std::string::npos) + { + ptr = smap["url"].find("=", ptr); + smap["url"].erase(0,ptr+1); + + if((ptr = smap["url"].find("&")) != std::string::npos) + yurl.sig = smap["url"].substr(0,ptr); + } + int id = atoi(smap["itag"].c_str()); if (supportedFormat(id) && !yurl.url.empty() && !yurl.sig.empty()) { yurl.quality = smap["quality"];