Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(DataFlex) Avoiding Outbound Links Matching Patterns

The spider accumulates outbound links when crawling. Your program may specify any number of "avoid patterns" to prevent any link matching at least one of the wildcarded patterns from being added.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoSpider
    Boolean iSuccess
    Integer i
    String sUrl
    String sTemp1
    Integer iTemp1

    Get Create (RefClass(cComChilkatSpider)) To hoSpider
    If (Not(IsComObjectCreated(hoSpider))) Begin
        Send CreateComObject of hoSpider
    End

    //  --------------------------------------------------------------------
    //  Note: The URLs in this example are no longer valid.
    //  You should replace the URLs with URLs from a site of your
    //  own choosing -- preferably your own site if testing.
    //  (Google's Directory no longer exists.)
    //  --------------------------------------------------------------------

    //  First, we'll get the outbound links for a page in the
    //  Google directory.  Then we'll add some avoid patterns
    //  and then re-fetch, to see it work...

    Send ComInitialize To hoSpider "directory.google.com"
    Send ComAddUnspidered To hoSpider "http://directory.google.com/Top/Recreation/Food/Cheese/"

    Get ComCrawlNext Of hoSpider To iSuccess

    //  Display the outbound links

    Get ComNumOutboundLinks Of hoSpider To iTemp1
    For i From 0 To (iTemp1 - 1)
        Get ComGetOutboundLink Of hoSpider i To sTemp1
        Showln sTemp1
    Loop

    //  The output:
    //  http://www.cheese.com/
    //  http://www.cheesediaries.com/
    //  http://www.WisDairy.com/
    //  http://www.newenglandcheese.com
    //  http://www.ilovecheese.com
    //  http://www.cheesefromspain.com
    //  http://www.realcaliforniacheese.com/
    //  http://www.frencheese.co.uk/
    //  http://www.cheesesociety.org/
    //  http://www.specialcheese.com/queso.htm
    //  http://www.franceway.com/cheese/intro.htm
    //  http://www.foodsubs.com/Chesfirm.html
    //  http://www.cheeseboard.co.uk/
    //  http://www.thecheeseweb.com/
    //  http://www.vtcheese.com/
    //  http://www.coldbacon.com/cheese.html
    //  http://www.norwegiancheeses.co.uk/
    //  http://www.reluctantgourmet.com/cheese.htm
    //  http://www.lancewood.co.za/
    //  http://www.switzerlandcheese.ca
    //  http://www.frenchcheese.dk/
    //  http://www.dolcevita.com/cuisine/cheese/cheese.htm
    //  http://cheeseisland.net/
    //  http://www.cheestrings.ca/
    //  http://www.dreamcheese.co.uk
    //  http://hgic.clemson.edu/factsheets/HGIC3506.htm
    //  http://www.epicurious.com/cooking/how_to/food_dictionary/entry?id=1815
    //  http://www.mousetrapcheese.co.uk
    //  http://taquitos.net/yum/gc.shtml
    //  http://www.greek-recipe.com/static/greek-cheese
    //  http://www.park.org/Netherlands/pavilions/food_and_markets/cheese/introduction.html
    //  http://www.dairyfarmers.org/engl/recipes/4_1.asp
    //  http://www.prairieridgecheese.com/wischeesguid.html
    //  http://dmoz.org/cgi-bin/add.cgi?where=Recreation/Food/Cheese
    //  http://dmoz.org/about.html
    //  http://dmoz.org/cgi-bin/apply.cgi?where=Recreation/Food/Cheese

    //  Do it again, but this time with avoid patterns.
    Send ComInitialize To hoSpider "directory.google.com"
    Send ComAddUnspidered To hoSpider "http://directory.google.com/Top/Recreation/Food/Cheese/"

    //  Add some avoid patterns:
    Send ComAddAvoidOutboundLinkPattern To hoSpider "*dmoz.org*"
    Send ComAddAvoidOutboundLinkPattern To hoSpider "*?id=*"
    Send ComAddAvoidOutboundLinkPattern To hoSpider "*.co.uk*"
    Get ComCrawlNext Of hoSpider To iSuccess

    Showln "-----------------------"

    //  Display the outbound links
    Get ComNumOutboundLinks Of hoSpider To iTemp1
    For i From 0 To (iTemp1 - 1)
        Get ComGetOutboundLink Of hoSpider i To sTemp1
        Showln sTemp1
    Loop

    //  Output:
    //  http://www.cheese.com/
    //  http://www.cheesediaries.com/
    //  http://www.WisDairy.com/
    //  http://www.newenglandcheese.com
    //  http://www.ilovecheese.com
    //  http://www.cheesefromspain.com
    //  http://www.realcaliforniacheese.com/
    //  http://www.cheesesociety.org/
    //  http://www.specialcheese.com/queso.htm
    //  http://www.franceway.com/cheese/intro.htm
    //  http://www.foodsubs.com/Chesfirm.html
    //  http://www.thecheeseweb.com/
    //  http://www.vtcheese.com/
    //  http://www.coldbacon.com/cheese.html
    //  http://www.reluctantgourmet.com/cheese.htm
    //  http://www.lancewood.co.za/
    //  http://www.switzerlandcheese.ca
    //  http://www.frenchcheese.dk/
    //  http://www.dolcevita.com/cuisine/cheese/cheese.htm
    //  http://cheeseisland.net/
    //  http://www.cheestrings.ca/
    //  http://hgic.clemson.edu/factsheets/HGIC3506.htm
    //  http://taquitos.net/yum/gc.shtml
    //  http://www.greek-recipe.com/static/greek-cheese
    //  http://www.park.org/Netherlands/pavilions/food_and_markets/cheese/introduction.html
    //  http://www.dairyfarmers.org/engl/recipes/4_1.asp
    //  http://www.prairieridgecheese.com/wischeesguid.html


End_Procedure

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.