00001 /*************************************************************************** 00002 * Copyright (C) 2004 by Frodo + PrAn * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License * 00015 * along with this program; if not, write to the * 00016 * Free Software Foundation, Inc., * 00017 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00018 ***************************************************************************/ 00019 00028 #ifndef C_HTTP_SEARCH_H 00029 #define C_HTTP_SEARCH_H 00030 00031 #include <cstdlib> 00032 #include <string> 00033 #include <vector> 00034 00044 const char first_url[]="http://www.google.com/palm?q=allintitle%3A"; 00045 00055 const char second_url[]="+lyrics&hl=en&lr=&ie=ISO-8859-1&safe=off"; 00056 00064 typedef class cHttpSearch* P_HTTP; 00065 //typedef class cHttpResult* P_HTTP_RES; 00066 00077 class cHttpSearch { 00078 00079 00080 public: 00081 00092 cHttpSearch(); 00093 00106 std::string createURL(std::string title); //url creation for google search request 00107 00121 std::string getHtmlBody(std::string google_url); 00122 00137 int extractLyricsUrl(std::string body); 00138 00151 std::string extractLyrics(std::string HtmlBody); 00152 00165 std::string cHttpSearch::StringsTagRemover(std::string body); 00166 }; 00167 00168 00178 class cHttpResultsVector { 00179 00180 private: 00191 static std::vector<std::string> LyricsUrls; 00192 public: 00193 00204 cHttpResultsVector(); 00205 00217 int getVectorSize(); 00218 00229 void clearVector();//clears the URLs contained by vector 00230 00243 std::string getLyricsUrl(int number); 00244 00256 void addLyricsUrl(std::string new_result); 00257 00258 00259 }; 00260 /* 00261 class cHttpResult { 00262 00263 private: 00264 char address[200]={\0}; 00265 int number=0; 00266 P_HTTP_RES next_res=NULL; 00267 00268 public: 00269 cHttpResult(); 00270 void setHttpResultAddr(P_HTTP_RES res, char* addr); 00271 char* getHttpResultAddr(P_HTTP_RES res); 00272 void setHttpResultNext(P_HTTP_RES res); 00273 P_HTTP_RES getHttpResultNext (P_HTTP_RES res); 00274 };*/ 00275 00276 #endif