nielsbosma / SeoTools-for-Excel-Connectors

MIT License
80 stars 83 forks source link

Ahrefs Connector - Linked Domains by type sums issue #43

Closed simplexx closed 1 year ago

simplexx commented 1 year ago

SEO Tools for excel just consumed around 1 Million API credits in less than a minute because I used Linked Domains by type sums functionality for a list of domains, which is flawed.

These credits are pretty expensive and there is absolutely no need for using that many credits, because all we want are the totals and not every domain.

Looking at the code, it seems that LinkedDomainsByTypeSums does not limit the returned rows, which means that every single external link is returned in a row and consumes one credit. All we are interested in however is the following part of the returned value:

"stats": { "linked_domains": 5, "all": 5, "text": 5, "image": 0, "nofollow": 2, "dofollow": 3, "redirect": 0, "canonical": 0, "gov": 5, "edu": 0, "rss": 0, "alternate": 0, "max_links": 3, "max_links_dofollow": 3, "total_links": 9, "total_links_dofollow": 6 },

Currently, a request looks like this:

/api/v2?token=&output=json&from=linked_domains_by_type&target=website.com&mode=subdomains

I suggest to limit the returned domains inside the "domains": [] array to 1 (or even 0?) using limit=1:

/api/v2?token=&output=json&from=linked_domains_by_type&target=website.com&limit=1&mode=subdomains

Domains are not needed for LinkedDomainsByTypeSums, we are only interested in "stats", so limiting returned domains should not cause any issues.

However, due to the fact that all my API credits are used up, I can not test it until they are refilled again in a few days luckily, but I believe that adding limit=1 or limit=0 might solve this problem.

diskborsteMC commented 1 year ago

Thanks, updated with limit=0 parameter.