This project utilizes the Node.js framework to scrape movie information from IMDb using Cheerio and Axios libraries. The scraped data is then exposed as an API using Express.js.
- Node.js installed on your machine
- Clone or download the project repository.
- Open a terminal and navigate to the project directory.
- Run the command
npm install
to install the required dependencies.
- In the project directory, open the
index.js
file. - You will find a function called
scrapMoviseInfo
which is responsible for scraping the movie information from IMDb. - The function accepts a URL as a parameter and returns a list of movie objects containing properties such as title, link, poster URL, and rating.
- Modify the API routes in the
index.js
file according to your requirements. Currently, the following routes are defined:/api/top
: Retrieves the top-rated movies from IMDb./api/moviemeter
: Retrieves movies by popularity from IMDb./api/toptv
: Retrieves the top-rated TV shows from IMDb./api/tvmeter
: Retrieves TV shows by popularity from IMDb.
- To start the server, run the command
node index.js
. The server will be running on port 5555. - Open your preferred API testing tool or web browser and access the desired API route to retrieve the scraped movie information.
If the server is running locally, you can access the APIs as follows:
- To retrieve the top-rated movies: http://localhost:5555/api/top
- To retrieve movies by popularity: http://localhost:5555/api/moviemeter
- To retrieve the top-rated TV shows: http://localhost:5555/api/toptv
- To retrieve TV shows by popularity: http://localhost:5555/api/tvmeter
Alternatively, you can access the deployed version of this project in the cloud:
- Deployed project: https://www-imdb-com.onrender.com/