This Node.js script scrapes anchor tags (links) from a webpage and extracts their titles and href attributes using the x-ray package.
This script allows users to scrape anchor tags (links) from a webpage and extract their titles and href attributes. It provides a simple command-line interface (CLI) for specifying the URL of the webpage to be scraped.
Before using this script, ensure you have the following prerequisites installed:
- Node.js: Download and install Node.js
- npm (Node Package Manager): Included with Node.js installation
-
Fork and Clone the Repository
git clone https://github.com/Mohitsen11/fileverse_task.git
-
Navigate to the Directory
cd fileverse_task
-
Install Required Dependencies
npm i
- To use the script, run the following command in your terminal:
node index.js <URL>
- Example of how to use the script with a specific URL.
- Replace with the URL of the webpage you want to scrape.
node index.js https://example.com