library/src/blockclass/BP-BlockClass.cc
/*
 * Blockparty Bing Scraping Interface:
 * ------------------------------------------------
 * Allows for the extraction and storage of bing search results.  This
 * requires a valid HTTP session to work.
 *
 */
Blockparty Bing Scraping Interface.

Allows for the extraction and storage of bing search results.  This
requires a valid HTTP session to work.
Blockparty Bing Scraping Interface . Allows for the extraction and storage of bing search results . This requires a valid HTTP session to work .
BP_ERROR_T Block::runBingSearch(char *query)
{
	P_BP_HTTP_SESSION http_session = this->httpSession;
	if (!http_session)
		return ERR_FAILURE;
	if (!this->bing_session)
		this->bing_session = BP_OpenNewBingSearch(query, http_session);
	if (this->custom_bing_blacklist)
	{
		this->bing_session->custom_blacklist = this->custom_bing_blacklist;
		size_t i = 0;
		for (; this->custom_bing_blacklist[i]; i++) {
		}
		this->bing_session->custom_blacklist_count = i;
	}
	while
	(
		BP_RetrieveBingResult(this->bing_session, this->secs_between_bing_request) != ERR_FAILURE
	)
	{
		this->AddWarningToStack((char *) "\n [+] Retrieving result");
	}
	if (this->bing_session->captcha_activated)
	{
		this->AddErrorToStack((char*) "\n Fatal: Bing Search Captcha Activated");
		printf("\n [!!] Fatal: Bing Search Captcha Activated");
		exit(0);
	}
	return ERR_SUCCESS;
}
BP_ERROR_T Block :: runBingSearch ( char * query ) { P_BP_HTTP_SESSION http_session = this -> httpSession ; if ( ! http_session ) return ERR_FAILURE ; if ( ! this -> bing_session ) this -> bing_session = BP_OpenNewBingSearch ( query , http_session ) ; if ( this -> custom_bing_blacklist ) { this -> bing_session -> custom_blacklist = this -> custom_bing_blacklist ; size_t i = 0 ; for ( ; this -> custom_bing_blacklist [ i ] ; i ++ ) { } this -> bing_session -> custom_blacklist_count = i ; } while ( BP_RetrieveBingResult ( this -> bing_session , this -> secs_between_bing_request ) != ERR_FAILURE ) { this -> AddWarningToStack ( ( char * ) " \n " ) ; } if ( this -> bing_session -> captcha_activated ) { this -> AddErrorToStack ( ( char * ) " \n " ) ; printf ( " \n " ) ; exit ( 0 ) ; } return ERR_SUCCESS ; }
Blockparty Bing Scraping Interface:
Blockparty Bing Scraping Interface :
// open/setup query interface // set the custom blacklist in the class // set the list pointer in the bing scraper structure // loop to get list entry count // set custom balcklist count // retrieve query results // debug message if necessary // printf("\n Gets past retrievebingresult?"); // return indicating success