| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Description
A simple and easy to use Qt interface to extract TLD, domain, subdomain and registrable/registered domain of a valid host
The TLDExtractor passed test provided by "publicsuffix.org" at the bottom of "this" page.
Usage
#include "tldextractor.h"
//
//
// in body of your code
TLDExtractor tldExtractor;
tldExtractor.setDataSearchPaths(QStringList()
<< "/path1/to/data-file-dir"
<< "/path2/to/test-file-dir"); // note that path1 has preceding over path2
const QString host = QLatin1String("en.saaghar.pozh.org");
qDebug() << tldExtractor.TLD(host) << "\n"
<< tldExtractor.domain(host) << "\n"
<< tldExtractor.subdomain(host) << "\n"
<< tldExtractor.registrableDomain(host);And output is as follows:
org
pozh
en.saaghar
pozh.org
If you want to minimize function calls (one call instead four calls), then change the last line of above example as follows:
TLDExtractor::HostParts hostParts = tldExtractor.splitParts(host);
qDebug() << hostParts.tld << "\n"
<< hostParts.domain << "\n"
<< hostParts.subdomain << "\n"
<< hostParts.registrableDomain;Version
The latest version is 1.0
Related Links
CopyRight
| Back | FazBrowse Home | New Git URL |