diff --git a/README.md b/README.md index 04ded2920..98e6b746f 100644 --- a/README.md +++ b/README.md @@ -119,3 +119,4 @@ SR No | Project | Author 2 | [Pycon Proposals Scraper](https://github.com/Python-World/Python_and_the_Web/tree/master/Scripts/Web_Scrappers/Pycon_Proposals)| [Aditya Jetely](https://github.com/AdityaJ7) 3 | [Hacktoberfest Events Scraper](https://github.com/Python-World/Python_and_the_Web/tree/master/Scripts/Web_Scrappers/Hacktoberfest_Events)| [Aditya Jetely](https://github.com/AdityaJ7) 4 | [Wifi Speed Tester](https://github.com/Python-World/Python_and_the_Web/tree/master/Scripts/Miscellaneous/Wifi_Speed)| [AdeshChoudhar19](https://github.com/AdeshChoudhar19) +5 | [Google Search Using Python](https://github.com/Python-World/Python_and_the_Web/tree/master/Scripts/Miscellaneous/Wifi_Speed)| [Naman Jain](https://github.com/nj1902) diff --git a/Scripts/Web_Scrappers/Google Search Using Python/README.md b/Scripts/Web_Scrappers/Google Search Using Python/README.md new file mode 100644 index 000000000..556bef525 --- /dev/null +++ b/Scripts/Web_Scrappers/Google Search Using Python/README.md @@ -0,0 +1,33 @@ +

GOOGLE SEARCH

+ +> To install the google module, we can use the pip package installer. + +``` +pip install -r requirements.txt +``` + +> We are using search() function from the googlesearch module. +``` +search(query, tld='co.in', lang='en', num=10, start=0, stop=None, pause=2) +``` +## Function Description +>> **query**: This is the text that you want to search for.
+>> **tld**: This refers to the top level domain value like co.in or com which will specify which Google website we want to use.
+>> **lang**: This parameter stands for language.
+>> **num**: This is used to specify the number of results we want.
+>> **start**: This is to specify from where to start the results. We should keep it 0 to begin from the very start.
+>> **stop**: The last result to retrieve. Use None to keep searching forever.
+>> **pause**: This parameter is used to specify the number of seconds to pause between consecutive HTTP requests because if we hit too many requests, Google can block our IP address. + +## Contributor ✨ + + + + + + +
💻 Naman Jain 💻
+ + + + \ No newline at end of file diff --git a/Scripts/Web_Scrappers/Google Search Using Python/code.py b/Scripts/Web_Scrappers/Google Search Using Python/code.py new file mode 100644 index 000000000..198d30b06 --- /dev/null +++ b/Scripts/Web_Scrappers/Google Search Using Python/code.py @@ -0,0 +1,12 @@ +# We will be using the search() function from the googlesearch module. +from googlesearch import search + +def query_finder(query): + for item in search(query, tld = "co.in", num=10, stop = 10, pause = 2): + print(item) + +if __name__ == "__main__": + query = input("Enter your query : ") # This is the text that you want to search for. + query_finder(query) + + diff --git a/Scripts/Web_Scrappers/Google Search Using Python/requirements.txt.txt b/Scripts/Web_Scrappers/Google Search Using Python/requirements.txt.txt new file mode 100644 index 000000000..e3db9136e --- /dev/null +++ b/Scripts/Web_Scrappers/Google Search Using Python/requirements.txt.txt @@ -0,0 +1 @@ +google \ No newline at end of file