crawlbot api updates

This commit is contained in:
Matt Wells 2013-09-17 15:59:50 -07:00
parent e50da4d012
commit 2beff7f7d8
5 changed files with 13 additions and 11 deletions

@ -517,9 +517,3 @@ bool CollectionRec::hasSearchPermission ( TcpSocket *s , long encapIp ) {
return false;
}
char *CollectionRec::getDiffbotToken ( long *tokenLen ) {
char *s = strchr ( m_coll , '-' );
if ( ! s ) return NULL;
*tokenLen = s - m_coll;
return m_coll;
}

@ -101,7 +101,7 @@ class CollectionRec {
CollectionRec();
virtual ~CollectionRec();
char *getDiffbotToken ( long *tokenLen );
//char *getDiffbotToken ( long *tokenLen );
// . set ourselves from serialized raw binary
// . returns false and sets errno on error

@ -1853,6 +1853,7 @@ bool printCrawlBotPage ( TcpSocket *s ,
"<option value=frontpage%s>FrontPage</option>"
"</select>"
"</td>"
"</tr>"
, s[0]
, s[1]
, s[2]
@ -1862,6 +1863,7 @@ bool printCrawlBotPage ( TcpSocket *s ,
sb.safePrintf(
//
"<tr>"
"<td><b>Download Objects:</b> "
"</td><td>"
"<a href=/crawlbot/downloadobjects?"

@ -162,6 +162,15 @@ bool sendReply ( void *state ) {
, mstrerror(xd->m_indexCode) );
}
sb.safeTruncateEllipsis(xd->m_firstUrl.getUrl(),60);
if ( xd->m_indexCode == 0 ) {
if ( xd->m_numOutlinksAddedValid )
sb.safePrintf(" &nbsp; (added %li outlinks)",
(long)xd->m_numOutlinksAdded);
else
sb.safePrintf(" &nbsp; (added 0 outlinks)");
}
sb.safePrintf("</font></b>");
sb.nullTerm();
// this will call g_httpServer.sendReply()

@ -11883,10 +11883,7 @@ SafeBuf *XmlDoc::getDiffbotReply ( ) {
);
//diffbotUrl.safePrintf("http://54.212.86.74/api/%s?token=%s&u="
long tokenLen;
char *token = m_cr->getDiffbotToken ( &tokenLen );
diffbotUrl.safePrintf("token=");
diffbotUrl.safeMemcpy(token,tokenLen);
diffbotUrl.safePrintf("token=%s",m_cr->m_diffbotToken.getBufStart());
diffbotUrl.safePrintf("&url=");
// give diffbot the url to process
diffbotUrl.urlEncode ( m_firstUrl.getUrl() );