Computer Science, asked by TransitionState, 10 months ago

a computer program that searches document especially on the world wide web 8 computer program that searches documents especially on the world wide web ​

Answers

Answered by fiercespartan
4

To do this, we will need to do 2 things.

1) We need to search on the world wide web first using webbrowser module on python

2) Then, we need to HTML parsing or also known as web scraping.

______________________________________________

First, let's search on the google:

To do that, we will need the module web browser, if the module is not installed, go to your command prompt on windows or bash on mac and type in : pip install webbrowser

What this module does it, it opens your browser for you. What ever is your default one is. Chrome,firefox,microsoft edge.

If you want to check whether this module is installed or not, open your IDLE and type in import webbrowser.

If there is no error, then webbrowser is installed. Now for the step 2.

______________________________________________

Web scraping, all we have to do is search the web for the term document and post that link on your python screen.

______________________________________________

Before doing anything, we will need to ask the user for what to search on google. Like about biology, ecology, python and then we merge the input into the url and then search for documents.

______________________________________________

CODE:

import webbrowser

import requests

from lxml import html #import lxml using command prompt/bash

search_query = input('What do you want to search for?)

searches = start_page = requests.get(f'https://www.google.com/search?q={search_query}'+'documents')

html_stuff =  html.fromstring(start_page.text)

#I am going to just do this code for the first 10 searches. You can keep the limit as much as you want

for i in range(1, 11):

   link = html_stuff.xpath('//h3[@class="LC20lb"]/text()')[i]

   if 'document' in link:

       print(html_stuff.xpath('//cite[@class="iUh30 bc"]/text()')[i] )

_______________________________________________

It's a bit complicated for beginners, beautiful soup for web scraping is by far the easiest one to learn. But, lxml is much shorter. Before doing any programs like these, learn about  web scraping :)

Answered by indiabrainly
1

Answer:

Explanation:

"Google is the most popular computer program that is used around the world in order to search for documents in the world wide web. Some other such search engines are internet explorer, Yahoo! search,  Bing, Baidu, DuckDuckGo, Infospace, Yandex, Msn, Ask.com.

Search engines can be defined as a software program that has been designed to search for any kind of information, product, entertainment or service in the world wide web.

"

Similar questions