Script: Importance Checker (Updated Project List) (#132)

* Add files to fork

* Update README.md
This commit is contained in:
natesabrown 2019-11-25 11:42:55 -06:00 committed by Ayush Bhardwaj
parent ff0ca3a022
commit 97e8b2eb7c
4 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,36 @@
try:
from googlesearch import search
except ImportError:
print("No module named 'google' found.")
def ImportanceChecker(query, stoplevel=10, pauselevel=1):
"""
Checks 'importance' by analyzing google search results for a person/topic and
finding if they have a wikipedia page among the top results. Number of search
results required is automatically set to 10.
"""
#urlgenerator runs relatively slowly to prevent google from blocking user IP
urlgenerator = search(query, stop=stoplevel, pause=pauselevel)
for _ in range(stoplevel):
url = next(urlgenerator)
if 'wikipedia' in url:
return True
return False
def main():
print("Who do you want to be searched? ", end="")
query = input()
important = ImportanceChecker(query)
if (important):
print(f"{query} is important!")
else:
print(f"{query} isn't that important.")
if __name__ == "__main__":
main()

View File

@ -0,0 +1,22 @@
#Importance Checker
A simple program to check for a person or topic's "importance" by checking whether the search value's possible Wikipedia page appears in the top *x* Google search results, where *x* is set to 10 by default.
##Instructions
Type these commands in the terminal:
`pip install beautifulsoup`
`pip install google`
Now type:
`ImportanceChecker.py`
The program will run, and test a user-inputted value if in *main*. Use `import ImportanceChecker` to use it in your python project.
###Notes:
* *ImportanceChecker* runs relatively slow to help prevent Google from blocking the user's IP address. One can modify the time delay in between requests to speed the function up by changing the third parameter to something other than its default, *1*.

View File

@ -0,0 +1,2 @@
beautifulsoup4
google

View File

@ -40,6 +40,7 @@ So far, the following projects have been integrated to this repo:
|[HTML Table to List](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/HTML_Table_to_List) | [Nitish Srivastava](https://github.com/nitish-iiitd)|
|[Image circle formatter](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Image-Circulator) |[Berk Gureken](https://github.com/bureken) |
|[Image To PDF](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/images2pdf)|[msaoudallah](https://github.com/msaoudallah)|
|[Importance Checker](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/ImportanceChecker)|[natesabrown](https://github.com/natesabrown)|
|[Instadp Web Scrapper](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/InstadpShower)|[Psychiquest](https://github.com/psychiquest)|
|[Keylogger](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Keylogger) |[Preet Mishra](https://github.com/preetmishra) |
|[Minecraft Server in background](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Minecraft_server_in_background)|[Max von Forell](https://github.com/mvforell)|