Close Menu
Techs Slash

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Download Facebook Videos with SaveFrom.Net

    May 10, 2025

    Top 3 Cheap Transport Services in UAE

    May 10, 2025

    How To Save Money on Traveling in the UAE

    May 10, 2025
    Facebook X (Twitter) Instagram
    Techs Slash
    • Home
    • News
      • Tech
      • Crypto News
      • Cryptocurrency
    • Entertainment
      • Actors
      • ANGEL NUMBER
      • Baby Names
      • Beauty
      • beauty-fashion
      • facebook Bio
      • Fitness
      • Dubai Tour
    • Business
      • Business Names
    • Review
      • Software
      • Smartphones & Apps
    • CONTRIBUTION
    Facebook X (Twitter) Instagram
    Techs Slash
    Home»python»Python 3 Serpstack API Example to Track Position of Keywords of Website in Google SERPS in Command Line
    python

    Python 3 Serpstack API Example to Track Position of Keywords of Website in Google SERPS in Command Line

    Ranveer KumarBy Ranveer KumarSeptember 30, 2022No Comments2 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email

    Warning: Trying to access array offset on value of type bool in /home/cadesimu/techsslash.com/wp-content/themes/smart-mag/partials/single/featured.php on line 78
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Python 3 Serpstack API Example to Track Position of Keywords of Website in Google SERPS in Command Line

    import requests
    import os
    
    #get API key at http://serpstack.com?fpr=instant-serp-checker
    
    # Enter your parameters
    
    
    
    api_key = "##yourapikey##" #api key from serpstat dashboard
    query = "jspdf" #search keyword, e.g. payday loan
    target_domain = "codingshiksha.com" #the domain you want to find in the SERPs
    google_domain = "google.com" #the google domain you want to search from, e.g. google.co.uk
    country_code = "in" #country code of the country to search from. Has to follow ISO 3166 standard: https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
    language = "en" #language code of the language to search with. Has to follow ISO 639-1 standard: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
    results = 50 #number of results to scrape from the SERPs
    device = "desktop" #["desktop", "mobile", "tablet"] # search device
    
    
    #configure API parameters
    params = {
      'access_key': api_key,
      'device': device,
      'gl': country_code,
      'hl': language,
      'auto_location': '1',
      'google_domain':google_domain,
      'query': query,
      'num': results
    }
    
    # call api
    api_result = requests.get('http://api.serpstack.com/search', params)
    api_response = api_result.json()
    
    # clear terminal
    clear = lambda: os.system('clear')
    clear()
    
    #list top ten serps
    for number, result in enumerate(api_response['organic_results'], start=1):
        if target_domain in result['domain']:
          print("=====================================================================")
          print("%s. %s - %s" % (number, result['domain'], result['title']))
          print("=====================================================================")
        else:
          print("%s. %s - %s" % (number, result['domain'], result['title']))
    
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Ranveer Kumar
    • Website

    Related Posts

    JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    December 18, 2023

    Why does math.log result in ValueError: math domain error?

    December 17, 2023

    “inconsistent use of tabs and spaces in indentation” [duplicate]

    December 16, 2023
    Leave A Reply Cancel Reply

    Top Posts

    Sapne Me Nahane Ka Matlab

    March 18, 2024

    Sapne Me Nagn Stri Dekhna

    March 18, 2024

    Self Reliance: Release Date, Cast, Plot, Trailer, and More Information

    March 18, 2024

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    ABOUT TECHSSLASH

    Welcome to Techsslash! We're dedicated to providing you with the best of technology, finance, gaming, entertainment, lifestyle, health, and fitness news, all delivered with dependability.

    Our passion for tech and daily news drives us to create a booming online website where you can stay informed and entertained.

    Enjoy our content as much as we enjoy offering it to you

    Most Popular

    Sapne Me Nahane Ka Matlab

    March 18, 2024

    Sapne Me Nagn Stri Dekhna

    March 18, 2024

    Self Reliance: Release Date, Cast, Plot, Trailer, and More Information

    March 18, 2024
    CONTACT DETAILS

    Phone: +92-302-743-9438
    Email: contact@serpinsight.com

    Our Recommendation

    Here are some helpfull links for our user. hopefully you liked it.

    Techs Slash
    Facebook X (Twitter) Instagram Pinterest
    • Home
    • About us
    • contact us
    • Affiliate Disclosure
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • Write for us
    • Daman Game
    © 2025 Techsslash. All Rights Reserved

    Type above and press Enter to search. Press Esc to cancel.