This repository has been archived by the owner on Mar 5, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Arun Prakash Jana <[email protected]>
- Loading branch information
Showing
3 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ Copyright (C) 2008 Henri Hakkinen | |
|
||
Modified (2015) by Arun Prakash Jana <[email protected]> | ||
|
||
`google-cli` is a command line tool to search Google (Web & News) from the terminal. It shows the title, URL and text context for each result. Results are fetched in pages. Next or previous page navigation is possible using keyboard shortcuts. Results are indexed and a result URL can be opened in a browser using the index number. | ||
`google-cli` is a command line tool to search Google (Web & News) from the terminal. It shows the title, URL and text context for each result. Results are fetched in pages. Next or previous page navigation is possible using keyboard shortcuts. Results are indexed and a result URL can be opened in a browser using the index number. Supports sequential searches in a single instance. | ||
|
||
`google-cli` is GPLv3 licensed. It doesn't have any affiliation to Google in any way. | ||
|
||
|
@@ -16,6 +16,7 @@ Modified (2015) by Arun Prakash Jana <[email protected]> | |
> - Fetch n results in a go | ||
> - Start at n<sup>th</sup> result | ||
> - Fetch and navigate next or previous set of results | ||
> - Initiate a new search with original options (in a single instance) | ||
> - Easily open result URLs in browser from cmdline using index number | ||
> - Show full contextual text snippet in search results | ||
> - Specify search duration (in hours / days / weeks / months / years) | ||
|
@@ -53,8 +54,10 @@ Options | |
-d enable debugging | ||
|
||
Keys | ||
n, p press 'n' or 'p' and Enter to navigate forward and backward | ||
1-N press a number and Enter to open that result in browser</pre> | ||
n, p enter 'n' or 'p' to navigate forward or backward | ||
s terms enter 's' followed by keywords to initiate a new search (with original options) | ||
1-N enter a number to open that result in browser | ||
any other input exits googler</pre> | ||
|
||
<b>Configuration file</b> | ||
|
||
|
@@ -110,6 +113,9 @@ To remove, run: | |
|
||
# News | ||
|
||
>**04 Sep, 2015** | ||
> - Add incremental search | ||
>**03 Sep, 2015** | ||
> - Removed file type specific search as it can be done easily with `filetype:mime` option | ||
> - The utilily name is changed to googler (from google) to avoid any copyright infringements | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,9 +201,11 @@ def usage(): | |
print(" -t dN time limit search [h5 (5 hrs), d5 (5 days), w5 (5 weeks), m5 (5 months), y5 (5 years)]") | ||
print(" -d enable debugging\n") | ||
print("Keys") | ||
print(" n, p press 'n' or 'p' and Enter to navigate forward and backward") | ||
print(" 1-N press a number and Enter to open that result in browser\n") | ||
print("Version 1.2") | ||
print(" n, p enter 'n' or 'p' to navigate forward or backward") | ||
print(" s terms enter 's' followed by keywords to initiate a new search (with original options)") | ||
print(" 1-N enter a number to open that result in browser") | ||
print(" any other input exits googler\n") | ||
print("Version 1.5") | ||
print("Copyright (C) 2008 Henri Hakkinen.") | ||
print("Modified (2015) by Arun Prakash Jana <[email protected]>") | ||
print("Webpage: https://github.com/jarun/google-cli") | ||
|
@@ -290,6 +292,12 @@ if lang is not None: | |
if duration is not None: | ||
url += "tbs=qdr:" + duration + "&" | ||
|
||
baseurl = url | ||
basestart = start | ||
|
||
if debug: | ||
print("[DEBUG] Base URL [%s]" % url) | ||
|
||
url += "q=" + quote_plus(keywords[0]) | ||
for kw in keywords[1:]: | ||
url += "+" + quote_plus(kw) | ||
|
@@ -354,14 +362,14 @@ def fetch_results(): | |
|
||
results = [] | ||
while True: | ||
if nav == "n" or nav == "p": | ||
if nav == "n" or nav == "p" or nav =="s": | ||
results = fetch_results() | ||
|
||
oldstart = start | ||
if sys.version_info > (3,): | ||
nav = input("Press 'n', 'p', or number and Enter to continue... ") | ||
nav = input("Enter 'n', 'p', 's keywords', or number to continue... ") | ||
else: | ||
nav = raw_input("Press 'n', 'p', or number and Enter to continue... ") | ||
nav = raw_input("Enter 'n', 'p', 's keywords' or number to continue... ") | ||
|
||
if nav == "n": | ||
if num is not None: | ||
|
@@ -375,6 +383,18 @@ while True: | |
else: | ||
start = str(int(start) - 10) | ||
print("\n\x1B[91m\x1B[1m ***** ***** ***** ***** \x1B[0m\n") | ||
elif len(nav) > 2 and nav[0] == "s" and nav[1] == " ": | ||
trimsearch = nav[2:].strip().replace(" ", "+") | ||
if trimsearch == "": | ||
print("Empty string. Exiting...") | ||
break | ||
url = baseurl + "q=" + trimsearch | ||
if debug: | ||
print("New search URL [%s]" % url) | ||
nav = "s" | ||
start = basestart | ||
print("\n\x1B[91m\x1B[1m ***** ***** ***** ***** \x1B[0m\n") | ||
continue | ||
elif is_int(nav): | ||
index = int(nav) - 1 | ||
try: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters