Created
March 28, 2018 00:05
-
-
Save MrMe42/c44fd433762700485ec9c34816799f55 to your computer and use it in GitHub Desktop.
a simple web-searching python script
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
import re | |
import urllib.request as ur | |
print('What would you like to look up?') | |
text = input('::') | |
search_string = text.split(' ') | |
search_string = '+'.join(search_string) | |
# you can change www.bing.com to any search engine except google. | |
googlesearch = 'https://www.bing.com/search?q=' + search_string | |
source = ur.urlopen(googlesearch) | |
source = source.read() | |
source = str(source) | |
output = re.findall(r'''(?:http://|www.)[^"]+''', source) | |
for i in range(len(output)): | |
print(output[i]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment