Jul-11-2019, 03:21 PM
I didn't get any replies to the other related thread; and, because one other person in that thread had the same problem as me with no answers I thought it appropriate to start a new thread.
Original question:
"Man, I'm having trouble with this project too. I'm getting no search results after passing the search terms into the run window."
My script returns this output:
"Googling...
None
Press any key to continue . . ."
My script:
Original question:
"Man, I'm having trouble with this project too. I'm getting no search results after passing the search terms into the run window."
My script returns this output:
"Googling...
None
Press any key to continue . . ."
My script:
#! python3 # lucky.py - Opens several Google search results. import webbrowser, bs4, requests, sys print('Googling...') # display text while downloading the Google page res = requests.get('http://google.com/search?q=' + ' '.join(sys.argv[1:])) print(res.raise_for_status()) # Retreive top search result links. soup = bs4.BeautifulSoup(res.text, "html.parser") # Open a browser tab for each result linkElems = soup.select('.r a') numOpen = min(5, len(linkElems)) for i in range(numOpen): webbrowser.open('http://google.com' + linkElems[i].get('href'))