app-ads-txt v0.1.1
app-ads.txt
app-ads.txt crawler according to "IAB Technology Laboratory"
install
npm i app-ads-txt
How to use
const AppAdsTxtCrawler = require('app-ads-txt').Crawler;
const appAdsTxtCrawler = new AppAdsTxtCrawler(options);
const appAdsTxtData = appAdsTxtCrawler.crawlData('example.com');
Example of usage
input: example.com/app-ads.txt output:
{
"appAdsUrl": "https://example.com/app-ads.txt",
"data" : {
"variables": {},
"fields" :
[{
"domain" : "example.com",
"publisherAccountID" : "104023",
"accountType" : "DIRECT",
"certificateAuthorityID": "79929e88b2ba73bc"
}]
}
}
options:
{
"proxyUrl": "http://user:pass@example.com"
}
Exceptions
- ERR_INVALID_URL: on invalid input url
How it works (by "IAB Technology Laboratory")
Follow these steps to transform the developer URL into a path to crawl for locating an appads. txt file. 1. Extract the host name portion of the URL. 2. Remove any “www.” or “m.” prefix present in the host name. 3. Remove all but the first (and, if present, second) name from the host name which precedes the standard public suffix. For example: a. example.com simply remains example.com b. subdomain.example.com remains subdomain.example.com c. another.subdomain.example.com becomes subdomain.example.com d. another.subdomain.example.co.uk becomes subdomain.example.co.uk 4. Append /app-ads.txt to that path. 5. Crawlers should attempt to fetch the HTTPS version of the URL first, falling back to the HTTP version if SSL is unavailable.
License
MIT