I needed to find backlink opportunities by comparing my site with competitors. Here's a Python script using the SERPSpur Backlink Gap Analysis API to discover sites linking to competitors but not to me:
python
import requests
API_KEY = "your_api_key_here"
def backlink_gap(your_domain, competitor_domain):
response = requests.get(
"https://api.serpspur.com/v1/backlink-gap",
headers={"Authorization": f"Bearer {API_KEY}"},
params={"domain": your_domain, "competitors": competitor_domain}
)
data = response.json()
return data['opportunities']
your_site = "mywebsite.com"
competitor = "competitor.com"
opportunities = backlink_gap(your_site, competitor)
print(f"Sites linking to {competitor} but not to {your_site}:")
for opp in opportunities[:5]:
print(f" {opp['url']} (DA: {opp['domain_authority']})")
This revealed several high-authority sites I should reach out to. Have you tried a similar approach for link-building?
Top comments (2)
Backlink gap analysis is a game-changer for link building. I like to cross-reference those opportunities with content gaps on my site to craft personalized outreach pitches. What's your follow-up strategy after identifying these prospects?
Clean script—thanks for sharing! I've done this manually with tools like SEMrush, but automating the discovery process saves so much time. Do you also check for broken links on those opportunity sites as a next step?