CkSpider Python Programming
Reference Documentation

CkSpider

* This is a freeware class/component/library.

Chilkat Spider web crawler component.

Properties

# Returns a boolean value
get_AvoidHttps( )

# newVal is a boolean (input)
put_AvoidHttps( newVal )

If set the 1 (true) the spider will avoid all HTTPS URLs. The default is 0 (false).

# strOut is a CkString object (output)
get_CacheDir( strOut )

# dir is a string (input)
put_CacheDir( dir )

Specifies a cache directory to use for spidering. If either of the FetchFromCache or UpdateCache properties are true, this is the location of the cache to be used. Note: the Internet Explorer, Netscape, and FireFox caches are completely separate from the Chilkat Spider cache directory. You should specify a new and empty directory.

# Returns a boolean value
get_ChopAtQuery( )

# newVal is a boolean (input)
put_ChopAtQuery( newVal )

If equal to 1 (true), then the query portion of all URLs are automatically removed when adding to the unspidered list. The default value is 0 (false).

# Returns an integer value
get_ConnectTimeout( )

# newVal is an integer (input)
put_ConnectTimeout( newVal )

The maximum number of seconds to wait while connecting to an HTTP server.

# strOut is a CkString object (output)
get_Domain( strOut )

The domain name that is being spidered. This is the domain previously set in the Initialize method.

# Returns a boolean value
get_FetchFromCache( )

# newVal is a boolean (input)
put_FetchFromCache( newVal )

If equal to 1 (true) then pages are fetched from cache when possible. If 0, the cache is ignored. The default value is 1. Regardless, if no CacheDir is set then the cache is not used.

# Returns a boolean value
get_LastFromCache( )

Equal to 1 if the last page spidered was fetched from the cache. Otherwise equal to 0.

# strOut is a CkString object (output)
get_LastHtml( strOut )

The HTML text of the last paged fetched by the spider.

# strOut is a CkString object (output)
get_LastHtmlDescription( strOut )

The HTML META description from the last page fetched by the spider.

# strOut is a CkString object (output)
get_LastHtmlKeywords( strOut )

The HTML META keywords from the last page fetched by the spider.

# strOut is a CkString object (output)
get_LastHtmlTitle( strOut )

The HTML title from the last page fetched by the spider.

# sysTime is a SYSTEMTIME object (output)
get_LastModDate( sysTime )

The last-modification date of the last URL spidered.

# strOut is a CkString object (output)
get_LastModDateStr( strOut )

The last modification date/time from the last page fetched by the spider.

# strOut is a CkString object (output)
get_LastUrl( strOut )

The URL of the last page spidered.

# Returns an integer value
get_MaxResponseSize( )

# newVal is an integer (input)
put_MaxResponseSize( newVal )

The maximum HTTP response size allowed. The spider will automatically fail any pages larger than this size. The default value is 250,000 bytes.

# Returns an integer value
get_MaxUrlLen( )

# newVal is an integer (input)
put_MaxUrlLen( newVal )

The maximum URL length allowed. URLs longer than this are not added to the unspidered list. The default value is 200.

# Returns an integer value
get_NumAvoidPatterns( )

The number of avoid patterns previously set by calling AddAvoidPattern.

# Returns an integer value
get_NumFailed( )

The number of URLs in the component's failed URL list.

# Returns an integer value
get_NumOutboundLinks( )

The number of URLs in the component's outbound links URL list.

# Returns an integer value
get_NumSpidered( )

The number of URLs in the component's already-spidered URL list.

# Returns an integer value
get_NumUnspidered( )

The number of URLs in the component's unspidered URL list.

# str is a CkString object (output)
get_ProxyDomain( str )

# newVal is a string (input)
put_ProxyDomain( newVal )

(PreRelease) The domain name of a proxy host if an HTTP proxy is used.

# str is a CkString object (output)
get_ProxyLogin( str )

# newVal is a string (input)
put_ProxyLogin( newVal )

(PreRelease) If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.

# str is a CkString object (output)
get_ProxyPassword( str )

# newVal is a string (input)
put_ProxyPassword( newVal )

(PreRelease) If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.

# Returns an integer value
get_ProxyPort( )

# newVal is an integer (input)
put_ProxyPort( newVal )

(PreRelease) The port number of a proxy server if an HTTP proxy is used.

# Returns an integer value
get_ReadTimeout( )

# newVal is an integer (input)
put_ReadTimeout( newVal )

The maximum number of seconds to wait when reading from an HTTP server.

# Returns a boolean value
get_UpdateCache( )

# newVal is a boolean (input)
put_UpdateCache( newVal )

If equal to 1 (true) then pages saved to the cache. If 0, the cache is ignored. The default value is 1. Regardless, if no CacheDir is set then the cache is not used.

# strOut is a CkString object (output)
get_UserAgent( strOut )

# ua is a string (input)
put_UserAgent( ua )

To be documented soon...

# Returns an integer value
get_WindDownCount( )

# newVal is an integer (input)
put_WindDownCount( newVal )

The "wind-down" phase begins when this number of URLs has been spidered. When in the wind-down phase, no new URLs are added to the unspidered list. The default value is 0 which means that there is NO wind-down phase.

Methods

# pattern is a string (input)
AddAvoidOutboundLinkPattern( pattern )

Adds a wildcarded pattern to prevent collecting matching outbound link URLs. For example, if "*google*" is added, then any outbound links containing the word "google" will be ignored. The "*" character matches zero or more of any character.

# pattern is a string (input)
AddAvoidPattern( pattern )

Adds a wildcarded pattern to prevent spidering matching URLs. For example, if "*register*" is added, then any url containing the word "register" is not spidered. The "*" character matches zero or more of any character.

# pattern is a string (input)
AddMustMatchPattern( pattern )

Adds a wildcarded pattern to limit spidering to only URLs that match the pattern. For example, if "*/products/*" is added, then only URLs containing "/products/" are spidered. This is helpful for only spidering a portion of a website. The "*" character matches zero or more of any character.

# url is a string (input)
AddUnspidered( url )

To begin spidering you must call this method one or more times to provide starting points. It adds a single URL to the component's internal queue of URLs to be spidered.

# url is a string (input)
# urlOut is a CkString object (output)
CanonicalizeUrl( url, urlOut )

To be documented soon...

ClearFailedUrls( )

Clears the component's internal list of URLs that could not be downloaded.

ClearOutboundLinks( )

Clears the component's internal list of outbound URLs that will automatically accumulate while spidering.

ClearSpideredUrls( )

Clears the component's internal list of already-spidered URLs that will automatically accumulate while spidering.

# Returns a boolean value
CrawlNext( )

Crawls the next URL in the internal list of unspidered URLs. The URL is moved from the unspidered list to the spidered list. Any new links within the same domain and not yet spidered are added to the unspidered list. (providing that they do not match "avoid" patterns, etc.) Any new outbound links are added to the outbound URL list. This method returns the HTML of the page downloaded. If there are no more URLs left unspidered, a NULL value is returned. Information about the URL crawled is available in the properties LastUrl, LastFromCache, and LastModDate.

# strOut is a CkString object (output)
# Returns a boolean value
FetchRobotsText( strOut )

Returns the contents of the robots.txt file from the domain being crawled. This spider component will not crawl URLs excluded by robots.txt. If you believe the spider is not behaving correctly, please notify us at support@chilkatsoft.com and provide information detailing a case that allows us to reproduce the problem.

Returns True for success, False for failure.

# index is an integer (input)
# strOut is a CkString object (output)
# Returns a boolean value
GetAvoidPattern( index, strOut )

Returns the Nth avoid pattern previously added by calling AddAvoidPattern. Indexing begins at 0.

Returns True for success, False for failure.

# domain is a string (input)
# domainOut is a CkString object (output)
GetBaseDomain( domain, domainOut )

To be documented soon...

# url is a string (input)
# domainOut is a CkString object (output)
GetDomain( url, domainOut )

To be documented soon...

# index is an integer (input)
# strOut is a CkString object (output)
# Returns a boolean value
GetFailedUrl( index, strOut )

Returns the Nth URL in the failed URL list. Indexing begins at 0.

Returns True for success, False for failure.

# index is an integer (input)
# strOut is a CkString object (output)
# Returns a boolean value
GetOutboundLink( index, strOut )

Returns the Nth URL in the outbound link URL list. Indexing begins at 0.

Returns True for success, False for failure.

# index is an integer (input)
# strOut is a CkString object (output)
# Returns a boolean value
GetSpideredUrl( index, strOut )

Returns the Nth URL in the already-spidered URL list. Indexing begins at 0.

Returns True for success, False for failure.

# index is an integer (input)
# strOut is a CkString object (output)
# Returns a boolean value
GetUnspideredUrl( index, strOut )

Returns the Nth URL in the unspidered URL list. Indexing begins at 0.

Returns True for success, False for failure.

# domain is a string (input)
Initialize( domain )

Initializes the component to begin spidering a domain. Calling Initialize clears any patterns added via the AddAvoidOutboundLinkPattern, AddAvoidPattern, and AddMustMatchPattern methods. The domain name passed to this method is what is returned by the Domain property. The spider only crawls URLs within the same domain.

# Returns a boolean value
RecrawlLast( )

Re-crawls the last URL spidered. This helpful when cookies set in a previous page load cause the page to be loaded differently the next time.

# index is an integer (input)
SkipUnspidered( index )

Moves a URL from the unspidered list to the spidered list. This allows an application to skip a specific URL.

# millisec is an integer (input)
SleepMs( millisec )

To be documented soon...

# index is an integer (input)
# Returns a string
avoidPattern( index )

To be documented soon...

# Returns a string
cacheDir( )

Specifies a cache directory to use for spidering. If either of the FetchFromCache or UpdateCache properties are true, this is the location of the cache to be used. Note: the Internet Explorer, Netscape, and FireFox caches are completely separate from the Chilkat Spider cache directory. You should specify a new and empty directory.

# url is a string (input)
# Returns a string
canonicalizeUrl( url )

To be documented soon...

# Returns a string
domain( )

The domain name that is being spidered. This is the domain previously set in the Initialize method.

# index is an integer (input)
# Returns a string
failedUrl( index )

To be documented soon...

# Returns a string
fetchRobotsText( )

Returns the contents of the robots.txt file from the domain being crawled. This spider component will not crawl URLs excluded by robots.txt. If you believe the spider is not behaving correctly, please notify us at support@chilkatsoft.com and provide information detailing a case that allows us to reproduce the problem.

# index is an integer (input)
# Returns a string
getAvoidPattern( index )

Returns the Nth avoid pattern previously added by calling AddAvoidPattern. Indexing begins at 0.

# domain is a string (input)
# Returns a string
getBaseDomain( domain )

To be documented soon...

# url is a string (input)
# Returns a string
getDomain( url )

To be documented soon...

# index is an integer (input)
# Returns a string
getFailedUrl( index )

Returns the Nth URL in the failed URL list. Indexing begins at 0.

# index is an integer (input)
# Returns a string
getOutboundLink( index )

Returns the Nth URL in the outbound link URL list. Indexing begins at 0.

# index is an integer (input)
# Returns a string
getSpideredUrl( index )

Returns the Nth URL in the already-spidered URL list. Indexing begins at 0.

# index is an integer (input)
# Returns a string
getUnspideredUrl( index )

Returns the Nth URL in the unspidered URL list. Indexing begins at 0.

# Returns a string
lastErrorHtml( )

Error information in HTML format for the last method called.

# Returns a string
lastErrorText( )

Error information in plain-text format for the last method called.

# Returns a string
lastErrorXml( )

Error information in XML format for the last method called.

# Returns a string
lastHtml( )

The HTML text of the last paged fetched by the spider.

# Returns a string
lastHtmlDescription( )

The HTML META description from the last page fetched by the spider.

# Returns a string
lastHtmlKeywords( )

The HTML META keywords from the last page fetched by the spider.

# Returns a string
lastHtmlTitle( )

The HTML title from the last page fetched by the spider.

# Returns a string
lastModDateStr( )

The last modification date/time from the last page fetched by the spider.

# Returns a string
lastUrl( )

The URL of the last page spidered.

# index is an integer (input)
# Returns a string
outboundLink( index )

To be documented soon...

# Returns a string
proxyDomain( )

(PreRelease) The domain name of a proxy host if an HTTP proxy is used.

# Returns a string
proxyLogin( )

(PreRelease) If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.

# Returns a string
proxyPassword( )

(PreRelease) If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.

# index is an integer (input)
# Returns a string
spideredUrl( index )

To be documented soon...

# index is an integer (input)
# Returns a string
unspideredUrl( index )

To be documented soon...

# Returns a string
userAgent( )

To be documented soon...