Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Optimize websites for both traditional search engines (Google, Bing) and AI engines (ChatGPT, Perplexity, Gemini)
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/domain_overview.py
1#!/usr/bin/env python32"""3Domain overview using DataForSEO API4Usage: python3 scripts/domain_overview.py "example.com"5"""6import argparse7from dataforseo_api import api_post, get_result, format_count8910def main():11parser = argparse.ArgumentParser(description="Domain overview")12parser.add_argument("domain", help="Target domain")13parser.add_argument("--location", "-loc", type=int, default=2840,14help="Location code (default: 2840 = US)")15args = parser.parse_args()1617data = [{18"target": args.domain,19"location_code": args.location,20"language_code": "en",21"limit": 1 # We only need overview metrics22}]2324response = api_post("dataforseo_labs/google/ranked_keywords/live", data)25results = get_result(response)2627print(f"domain: {args.domain}")28print(f"location: {args.location}")2930if results:31for result in results:32metrics = result.get("metrics", {})33if not metrics:34continue35organic = metrics.get("organic", {})36print(f"organic_keywords: {format_count(organic.get('count', 0))}")37print(f"organic_traffic: {format_count(organic.get('etv', 0))}")38print(f"top_3_positions: {organic.get('pos_1', 0) + organic.get('pos_2_3', 0)}")39else:40print("No results found")414243if __name__ == "__main__":44main()45