From c48ad04aa9ba476da5ae37637a0d6e01980ed3ca Mon Sep 17 00:00:00 2001
From: nj1902 <1902ben10@gmail.com>
Date: Thu, 1 Oct 2020 17:32:56 +0530
Subject: [PATCH 1/3] Added Google Search Script
---
README.md | 1 +
.../Google Search Using Python/README.md | 33 +++++++++++++++++++
.../Google Search Using Python/code.py | 6 ++++
3 files changed, 40 insertions(+)
create mode 100644 Scripts/Web_Scrappers/Google Search Using Python/README.md
create mode 100644 Scripts/Web_Scrappers/Google Search Using Python/code.py
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..135d7c7de
--- /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 google
+```
+
+> 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 ✨
+
+
+
+
+
+
\ 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..8696fad1e
--- /dev/null
+++ b/Scripts/Web_Scrappers/Google Search Using Python/code.py
@@ -0,0 +1,6 @@
+from googlesearch import search
+
+query = input()
+
+for item in search(query, tld = "co.in", num=10, stop = 10, pause = 2):
+ print(item)
\ No newline at end of file
From 8901abcbcb7abdc96bbc7cf4bb3f371912200fc5 Mon Sep 17 00:00:00 2001
From: nj1902 <1902ben10@gmail.com>
Date: Thu, 1 Oct 2020 18:33:02 +0530
Subject: [PATCH 2/3] Changes Updated
---
Scripts/Web_Scrappers/Google Search Using Python/README.md | 2 +-
Scripts/Web_Scrappers/Google Search Using Python/code.py | 4 +++-
.../Google Search Using Python/requirements.txt.txt | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
create mode 100644 Scripts/Web_Scrappers/Google Search Using Python/requirements.txt.txt
diff --git a/Scripts/Web_Scrappers/Google Search Using Python/README.md b/Scripts/Web_Scrappers/Google Search Using Python/README.md
index 135d7c7de..556bef525 100644
--- a/Scripts/Web_Scrappers/Google Search Using Python/README.md
+++ b/Scripts/Web_Scrappers/Google Search Using Python/README.md
@@ -3,7 +3,7 @@
> To install the google module, we can use the pip package installer.
```
-pip install google
+pip install -r requirements.txt
```
> We are using search() function from the googlesearch module.
diff --git a/Scripts/Web_Scrappers/Google Search Using Python/code.py b/Scripts/Web_Scrappers/Google Search Using Python/code.py
index 8696fad1e..a7b8745e7 100644
--- a/Scripts/Web_Scrappers/Google Search Using Python/code.py
+++ b/Scripts/Web_Scrappers/Google Search Using Python/code.py
@@ -1,6 +1,8 @@
+# We will be using the search() function from the googlesearch module.
from googlesearch import search
-query = input()
+query = input("Enter your query : ")
+# This is the text that you want to search for.
for item in search(query, tld = "co.in", num=10, stop = 10, pause = 2):
print(item)
\ No newline at end of file
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
From feb351907e9005ce2663c8df47dee2e1d6070c96 Mon Sep 17 00:00:00 2001
From: Aditya Jetely
Date: Fri, 2 Oct 2020 08:56:30 +0530
Subject: [PATCH 3/3] Update code.py
---
.../Google Search Using Python/code.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/Scripts/Web_Scrappers/Google Search Using Python/code.py b/Scripts/Web_Scrappers/Google Search Using Python/code.py
index a7b8745e7..198d30b06 100644
--- a/Scripts/Web_Scrappers/Google Search Using Python/code.py
+++ b/Scripts/Web_Scrappers/Google Search Using Python/code.py
@@ -1,8 +1,12 @@
# We will be using the search() function from the googlesearch module.
from googlesearch import search
-query = input("Enter your query : ")
-# This is the text that you want to search for.
-
-for item in search(query, tld = "co.in", num=10, stop = 10, pause = 2):
- print(item)
\ No newline at end of file
+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)
+
+