yt: need to encode search string

Origin commit data
------------------
Branch: ni/coolstream
Commit: 50e953cf27
Author: martii <m4rtii@gmx.de>
Date: 2013-06-09 (Sun, 09 Jun 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
martii
2013-06-09 11:05:25 +02:00
committed by Michael Liebmann
parent 1a507a05c6
commit 4bc0f07646
2 changed files with 12 additions and 0 deletions

View File

@@ -168,6 +168,16 @@ void cYTFeedParser::decodeUrl(std::string &url)
curl_free(str);
}
void cYTFeedParser::encodeUrl(std::string &txt)
{
CURL * curl_handle = curl_easy_init();
char * str = curl_easy_escape(curl_handle, txt.c_str(), txt.length());
curl_easy_cleanup(curl_handle);
if(str)
txt = str;
curl_free(str);
}
void cYTFeedParser::splitString(std::string &str, std::string delim, std::vector<std::string> &strlist, int start)
{
strlist.clear();
@@ -502,6 +512,7 @@ bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::stri
else if (mode == SEARCH) {
if (search.empty())
return false;
encodeUrl(search);
url = "http://gdata.youtube.com/feeds/api/videos?q=";
url += search;
url += "&";