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/keyword_research.py
1#!/usr/bin/env python32"""3Keyword research using DataForSEO API4Usage: python3 scripts/keyword_research.py "seo tools" --limit 205"""6import argparse7from dataforseo_api import api_post, get_result, print_keywords_list8910def main():11parser = argparse.ArgumentParser(description="Keyword research")12parser.add_argument("keyword", help="Seed keyword")13parser.add_argument("--location", "-loc", type=int, default=2840,14help="Location code (default: 2840 = US)")15parser.add_argument("--limit", "-l", type=int, default=20, help="Max results")16args = parser.parse_args()1718data = [{19"keywords": [args.keyword], # API requires 'keywords' array (up to 20)20"location_code": args.location,21"language_code": "en",22"limit": args.limit23}]2425response = api_post("keywords_data/google_ads/keywords_for_keywords/live", data)26results = get_result(response)2728print(f"keyword: {args.keyword}")29print(f"location: {args.location}")3031if results:32print_keywords_list(results[:args.limit])33else:34print("No results found")353637if __name__ == "__main__":38main()39