예제 #1
0
        private StructuredEngineResult GoogleSoap()
        {
            //System.Diagnostics.Debug.WriteLine("Houston, We're running in the Google SOAP routine");
            StructuredEngineResult returnItem = new StructuredEngineResult();
            Collection <StructuredResultElement> returnResults = new Collection <StructuredResultElement>();

            com.google.api.GoogleSearchService the_service = new global::com.sensepost.SPUDHelperClasses.com.google.api.GoogleSearchService();
            com.google.api.GoogleSearchResult  the_result  = new global::com.sensepost.SPUDHelperClasses.com.google.api.GoogleSearchResult();
            com.google.api.ResultElement       the_element = new global::com.sensepost.SPUDHelperClasses.com.google.api.ResultElement();
            try
            {
                the_result = the_service.doGoogleSearch(this.g_key, this.g_query, this.g_start, this.g_length, false, "", false, "", "latin1", "latin1");
            }
            catch (Exception ex)
            {
                StructuredResultElement str_res = new StructuredResultElement("Google", "", "", "", "", "", "ERROR:" + ex.Message.ToString());
                returnResults.Add(str_res);
                returnItem.ResultSource = "Google";
                returnItem.ResultTotal  = 0;
                returnItem.ResultItems  = returnResults;
                return(returnItem);
            }
            returnItem.ResultSource = "Google";
            returnItem.ResultTotal  = the_result.estimatedTotalResultsCount;
            for (int i = 0; i < the_result.resultElements.Length; i++)
            {
                the_element = the_result.resultElements[i];
                StructuredResultElement str_res = new StructuredResultElement("Google", the_element.URL.ToString(), the_element.cachedSize.ToString(), the_element.snippet.ToString(), the_element.summary.ToString(), the_element.title.ToString(), "SUCCESS");
                returnResults.Add(str_res);
            }
            returnItem.ResultItems = returnResults;
            return(returnItem);
        }
예제 #2
0
파일: Api_G.cs 프로젝트: Trowalts/SpUD
 private StructuredEngineResult GoogleSoap()
 {
     //System.Diagnostics.Debug.WriteLine("Houston, We're running in the Google SOAP routine");
     StructuredEngineResult returnItem = new StructuredEngineResult();
     Collection<StructuredResultElement> returnResults = new Collection<StructuredResultElement>();
     com.google.api.GoogleSearchService the_service = new global::com.sensepost.SPUDHelperClasses.com.google.api.GoogleSearchService();
     com.google.api.GoogleSearchResult the_result = new global::com.sensepost.SPUDHelperClasses.com.google.api.GoogleSearchResult();
     com.google.api.ResultElement the_element = new global::com.sensepost.SPUDHelperClasses.com.google.api.ResultElement();
     try
     {
         the_result = the_service.doGoogleSearch(this.g_key, this.g_query, this.g_start, this.g_length, false, "", false, "", "latin1", "latin1");
     }
     catch (Exception ex)
     {
         StructuredResultElement str_res = new StructuredResultElement("Google", "", "", "", "", "", "ERROR:" + ex.Message.ToString());
         returnResults.Add(str_res);
         returnItem.ResultSource = "Google";
         returnItem.ResultTotal = 0;
         returnItem.ResultItems = returnResults;
         return returnItem;
     }
     returnItem.ResultSource = "Google";
     returnItem.ResultTotal = the_result.estimatedTotalResultsCount;
     for (int i = 0; i < the_result.resultElements.Length; i++)
     {
         the_element = the_result.resultElements[i];
         StructuredResultElement str_res = new StructuredResultElement("Google", the_element.URL.ToString(), the_element.cachedSize.ToString(), the_element.snippet.ToString(), the_element.summary.ToString(), the_element.title.ToString(), "SUCCESS");
         returnResults.Add(str_res);
     }
     returnItem.ResultItems = returnResults;
     return returnItem;
 }