Skip to content

Ruby SEO keywords suggestion tool. Google Autocomplete, People Also Ask and Related Searches.

License

Notifications You must be signed in to change notification settings

chukhraiartur/seo-keywords-generator-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby SEO Keywords Generator

Pull keyword ideas using Google Autocomplete, People Also Ask and Related Searches.

seo-keywords-generator-ruby-logo

This tool uses SerpApi as a tool to parse data from Google search results.

You can use provided API key that will be available after installation, however, it's purely for testing purposes to see if the tool fits your needs. If you'll be using it for your own purpose (personal or commercial), you have to use your own SerpApi key.

⚙️Installation

$ gem install seo-keywords-generator-ruby

🤹‍♂️Usage

Available CLI arugments:

$ seo -h
Usage: seo [options]
    -q, --query QUERY                Search query (required)
    -e, --engines ENGINES            Choices of engines to extract: Autocomplete (ac), Related Searches (rs), People Also Ask (rq). You can select multiple engines by separating them with a comma: ac,rs. All engines are selected by default.
    -d, --depth-limit LIMIT          Depth limit for People Also Ask. Default is 0, first 2-4 results.
    -s, --save-to SAVE               Saves the results in the current directory in the selected format (CSV, JSON, TXT). Default CSV.
    -k, --api-key KEY                Your SerpApi API key: https://serpapi.com/manage-api-key. Default is a test API key to test CLI.
    -g, --domain DOMAIN              Google domain: https://serpapi.com/google-domains. Default google.com.
    -c, --country COUNTRY            Country of the search: https://serpapi.com/google-countries. Default us.
    -l, --language LANGUAGE          Language of the search: https://serpapi.com/google-languages. Default en.

The --depth-limit argument for People Also Ask can be set from 0 to 4. For each depth limit value, the number of results returned grows exponentially. Below is a table showing how the depth limit argument is affected:

Depth limit Number of results Explanation
0 4 Standard results
1 12 4*2 = 8 + 4 = 12
2 36 8*3 = 24 + 12 = 36
3 108 24*3 = 72 + 36 = 108
4 324 72*3 = 216 + 108 = 324

📌Note: This is how the logic works for the google.com domain, on other domains the results may differ.

Simple example:

$ seo -q "starbucks coffee"
{
  "auto_complete": [
    "starbucks coffee menu",
    "starbucks coffee sizes",
    "starbucks coffee cups",
    "starbucks coffee gear",
    "starbucks coffee beans",
    "starbucks coffee near me",
    "starbucks coffee drinks",
    "starbucks coffee mugs",
    "starbucks coffee traveler",
    "starbucks coffee price",
    "starbucks coffee machine",
    "starbucks coffee creamer",
    "starbucks coffee pods",
    "starbucks coffee recall",
    "starbucks coffee flavors"
  ],
  "related_searches": [
    "starbucks near me",
    "starbucks products",
    "amazon starbucks coffee instant",
    "starbucks logo",
    "starbucks drinks",
    "starbucks twitter",
    "starbucks cups",
    "starbucks facebook"
  ],
  "related_questions": [
    "What is best coffee in Starbucks?",
    "What is the Starbucks drink for St Patrick's Day?",
    "How do I order a regular coffee at Starbucks?",
    "What kind of coffee does Starbucks make?"
  ]
}

Advanced example:

This example will use related questions API engine with a depth limit value of 2, and saves data to JSON:

$ seo --api-key "<your_serpapi_api_key>" \
> -q "starbucks coffee" \
> -e rq \
> -d 2 \
> -g google.co.uk \
> -c uk \
> -l en \
> -s json \
{
  "related_questions": [
    "What is best coffee in Starbucks?",
    "What is Starbucks coffee called?",
    "Why is Starbucks famous for?",
    "Is Starbucks coffee good quality coffee?",
    "What is the most ordered drink at Starbucks?",
    "Which Starbucks coffee is best for beginners?",
    "What is the best choice in Starbucks?",
    "What is a good thing to order at Starbucks?",
    "What is Starbucks strongest coffee flavor?",
    "What is the most basic Starbucks coffee?",
    "Which Starbucks coffee is the least bitter?",
    "What should I order for my first coffee?",
    "Why is it called Starbuck?",
    "Is Starbucks Italian or Spanish?",
    "Why is Starbucks so expensive?",
    "Who is the woman on the Starbucks logo?",
    "Why is Starbucks called Grande?",
    "What does Grande and Venti mean?",
    "Why is a small Starbucks called tall?",
    "What country is Starbucks most popular?",
    "Why is Starbucks so expensive?",
    "What is the most famous drink at Starbucks?",
    "What is the most expensive thing in Starbucks?",
    "What's cheaper Dunkin or Starbucks?",
    "What are the weaknesses of Starbucks?",
    "What is the most ordered drink in the world?",
    "What is the most expensive Starbucks drink ever ordered?",
    "What is the most ordered drink?",
    "Which is the best quality coffee?",
    "Is Starbucks and McDonald's coffee the same?",
    "What is the number 1 coffee brand in the world?",
    "What is the most popular coffee in the world?",
    "What is the healthiest coffee to drink?",
    "Is Starbucks coffee arabica or robusta?",
    "Why is Starbucks coffee different?",
    "What country owns Starbucks coffee?"
  ]
}

Example of manual data extraction (without CLI):

require 'seo-keywords-generator-ruby'

keyword_research = SeoKeywordsGenerator::Scraper.new(
    query='starbucks coffee',
    api_key='<your_serpapi_api_key>',
    lang='en',
    country='us',
    domain='google.com'
)

auto_complete_results = keyword_research.get_auto_complete
related_searches_results = keyword_research.get_related_searches
related_questions_results = keyword_research.get_related_questions

data = {
    auto_complete: auto_complete_results,
    related_searches: related_searches_results,
    related_questions: related_questions_results
}

keyword_research.save_to_csv(data)
keyword_research.print_data(data)

✍Contributing

Feel free to open bug issue, something isn't working, what feature to add, or anything else related to Google autocomplete, related searches or people also ask.

Releases

No releases published

Packages

No packages published

Languages