Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

C Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
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
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(C) 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 C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Solaris C/C++

MinGW C/C++

#include <C_CkSpider.h>

void ChilkatSample(void)
    {
    HCkSpider spider;
    BOOL success;
    int i;
    const char *url;

    spider = CkSpider_Create();

    // --------------------------------------------------------------------
    // 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...

    CkSpider_Initialize(spider,"directory.google.com");
    CkSpider_AddUnspidered(spider,"http://directory.google.com/Top/Recreation/Food/Cheese/");

    success = CkSpider_CrawlNext(spider);

    // Display the outbound links

    for (i = 0; i <= CkSpider_getNumOutboundLinks(spider) - 1; i++) {
        printf("%s\n",CkSpider_getOutboundLink(spider,i));
    }

    // 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.
    CkSpider_Initialize(spider,"directory.google.com");
    CkSpider_AddUnspidered(spider,"http://directory.google.com/Top/Recreation/Food/Cheese/");

    // Add some avoid patterns:
    CkSpider_AddAvoidOutboundLinkPattern(spider,"*dmoz.org*");
    CkSpider_AddAvoidOutboundLinkPattern(spider,"*?id=*");
    CkSpider_AddAvoidOutboundLinkPattern(spider,"*.co.uk*");
    success = CkSpider_CrawlNext(spider);

    printf("-----------------------\n");

    // Display the outbound links
    for (i = 0; i <= CkSpider_getNumOutboundLinks(spider) - 1; i++) {
        printf("%s\n",CkSpider_getOutboundLink(spider,i));
    }

    // 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.htm


    CkSpider_Dispose(spider);

    }

 

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