mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
yt: need to encode search string
This commit is contained in:
@@ -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 += "&";
|
||||
|
@@ -88,6 +88,7 @@ class cYTFeedParser
|
||||
std::string getXmlData(xmlNodePtr node);
|
||||
|
||||
static size_t CurlWriteToString(void *ptr, size_t size, size_t nmemb, void *data);
|
||||
static void encodeUrl(std::string &txt);
|
||||
static void decodeUrl(std::string &url);
|
||||
static void splitString(std::string &str, std::string delim, std::vector<std::string> &strlist, int start = 0);
|
||||
static void splitString(std::string &str, std::string delim, std::map<std::string,std::string> &strmap, int start = 0);
|
||||
|
Reference in New Issue
Block a user