GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python/google.py at master · CHAOYUHONG/Python Expand file tree/ Copy pathgoogle.pyMore file actions executable file ·34 lines (29 loc) · 822 Bytes / Copy pathgoogle.pyFile metadata and controlsexecutable file ·34 lines (29 loc) · 822 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 """ Author: Ankit Agarwal (ankit167) Usage: python google.py <keyword> Description: Script googles the keyword and opens top 5 (max) search results in separate tabs in the browser Version: 1.0 """ import webbrowser import sys import pyperclip import requests import bs4 def main(): if len(sys.argv) > 1: keyword = ' '.join(sys.argv[1:]) else: # if no keyword is entered, the script would search for the keyword # copied in the clipboard keyword = pyperclip.paste() res=requests.get('http://google.com/search?q='+ keyword) res.raise_for_status() soup = bs4.BeautifulSoup(res.text) linkElems = soup.select('.r a') numOpen = min(5, len(linkElems)) for i in range(numOpen): webbrowser.open('http://google.com' + linkElems[i].get('href')) if __name__ == '__main__': main() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |