Skip to content

Instantly share code, notes, and snippets.

@MrMe42
Created March 28, 2018 00:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrMe42/c44fd433762700485ec9c34816799f55 to your computer and use it in GitHub Desktop.
Save MrMe42/c44fd433762700485ec9c34816799f55 to your computer and use it in GitHub Desktop.
a simple web-searching python script
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