Discover is a simple web application designed to demonstrate how search engines work by fetching results from Google. It allows users to input a query and retrieve both local and web-based search results, showcasing the use of web scraping techniques and data manipulation in JavaScript.
- Local search results from a predefined dataset.
- Web results fetched from Google, including titles, URLs, and descriptions.
- Basic pagination support for navigating through search results.
- Node.js: JavaScript runtime for building the server.
- Express: Web framework for Node.js to handle HTTP requests.
- Cheerio: Library for parsing and manipulating HTML.
- node-fetch: Lightweight module that enables
fetchAPI functionality in Node.js. - HTML/CSS: For building the front-end interface.
- Node.js (v14 or later)
- npm (Node package manager)
-
Clone the repository:
git clone https://github.com/manoj-chavan-13/discover.git cd discover -
Install the dependencies:
npm install
-
Start the server:
npm start
-
Open your browser and go to
http://localhost:3000/to access the application.
- Enter your search query in the input field.
- Click the "Search" button to retrieve results.
- View local results from the sample dataset as well as web results fetched from Google.
- Navigate through pages of results if necessary.
- Local Data: The application contains a sample dataset representing local search results.
- Web Scraping: For web results, the application fetches data from Google search results using the
node-fetchlibrary and parses the HTML response with Cheerio. - Descriptions: It fetches the meta descriptions of the web results after initial retrieval to provide more context.
- This project demonstrates basic functionality and may not handle edge cases or be optimized for production use.
- Web scraping may violate Google’s terms of service, and this project is intended for educational purposes only.
Contributions are welcome! If you have suggestions for improvements or features, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- Thanks to the creators of Node.js, Express, Cheerio, and node-fetch for making this project possible.
