cYTFeedParser: Fix decodeVideoInfo()

This commit is contained in:
FlatTV
2014-03-02 12:15:55 +01:00
committed by M. Liebmann
parent 3fa31ef441
commit c161760670

View File

@@ -406,7 +406,7 @@ bool cYTFeedParser::decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo)
std::string infofile = thumbnail_dir; std::string infofile = thumbnail_dir;
infofile += "/"; infofile += "/";
infofile += vinfo.id; infofile += vinfo.id;
infofile += ".txt" infofile += ".txt";
saveToFile(infofile.c_str(), answer); saveToFile(infofile.c_str(), answer);
#endif #endif
if(answer.find("token=") == std::string::npos) if(answer.find("token=") == std::string::npos)
@@ -440,7 +440,17 @@ bool cYTFeedParser::decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo)
#endif #endif
cYTVideoUrl yurl; cYTVideoUrl yurl;
yurl.url = smap["url"]; 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()); int id = atoi(smap["itag"].c_str());
if (supportedFormat(id) && !yurl.url.empty() && !yurl.sig.empty()) { if (supportedFormat(id) && !yurl.url.empty() && !yurl.sig.empty()) {
yurl.quality = smap["quality"]; yurl.quality = smap["quality"];