In this tutorial, we will learn how to Get Google Page Ranking in Python using the google library. Using this method, you can easily get the ranking of any website in google search results for any keyword. Using this python program, you can save a lot of time if you want to manually try the same, you will need to click many times and will need to search for the website manually which is a headache task.
We will need google library, to install it, type the below command in your terminal:
pip install google
Everything is pretty simple, we need to import the library and need to give some parameters like query and website name. We have explained everything using comments, let’s start:-
Code to Get Google Page Ranking in Python:
# importing library from googlesearch import search # enter website name website = input('Enter website: ') # enter query query = input('Enter query: ') # initilazing index=0 index = 0 # search will return an object containing # all url from google search results # here, tid is top level domain, # stop means how many search results you want # stop=100 means we will get top 100 results from google for i in search(query, tld="com", num=10, stop=100, pause=2): # checking website in results if website in i: # printing index of website and url print(index+1, i) index += 1
Output1:
Enter website: copyassignment
Enter query: python projects for resume
Website rank is: 1
URL is: https://copyassignment.com/20-python-projects-for-resume/
Check the below screenshot as proof:
Output2:
Enter website: copyassignment
Enter query: python oop projects
Website rank is: 1
URL is: https://copyassignment.com/python-oop-projects-source-code-and-example/
Check the below screenshot as proof:
There are some other ways to check the ranking of a website in google search results using Python, we are giving links to the best articles.
- with requests and urllib libraries(you will need google API for this method), link-> How to Get Google Page Ranking in Python
- with requests and beautifulSoup libraries, link-> How to get Rank of the page in google search results using BeautifulSoup?
Also Read:
- Imagination to Reality, Unlocking the Future: Genesis Physics Engine for 4D Simulation
- Simple Code to compare Speed of Python, Java, and C++?
- Falling Stars Animation on Python.Hub October 2024
- Most Underrated Database Trick | Life-Saving SQL Command
- Python List Methods
- Top 5 Free HTML Resume Templates in 2024 | With Source Code
- How to See Connected Wi-Fi Passwords in Windows?
- 2023 Merry Christmas using Python Turtle
- 23 AI Tools You Won’t Believe are Free
- Python 3.12.1 is Now Available
- Best Deepfake Apps and Websites You Can Try for Fun
- Amazon launched free Prompt Engineering course: Enroll Now
- 10 GitHub Repositories to Master Machine Learning
- Hello World in 35 Programming Languages
- How to Scrape Data From Any Website with Python?
- Become Job Ready With Free Harvard Computer Science course: Enroll Now
- Free Python Certification course from Alison: Good for Resume
- Download 1000+ Projects, All B.Tech & Programming Notes, Job, Resume & Interview Guide, and More – Get Your Ultimate Programming Bundle!
- Udacity Giving Free Python Course: Here is how to Enroll
- Love Babbar’s Income Revealed
- Top 5 Websites to Learn Programming in 2024
- Python Internship for college students and freshers: Apply Here
- Microsoft Giving Free Python Course in 2023: Enroll Now
- Top 5 Free Python Courses on YouTube in 2024
- Complete Python Roadmap for Beginners in 2024
- New secrets to Earn money with Python in 2024
- Connect with HR Directly – Job Hack
- Google offering free Python course: Enroll Today
- What is an AI Tool?
- Google Internship 2024