# HACXK Tamil Movie Scraper

Welcome to the HACXK Tamil Movie Scraper! This project provides a set of functions to scrape movie details from the TamilYogi website. You can search for movies, fetch details from specific movie URLs, and list movies by category.

## Features

- **Search Movies**: Search for movies by keyword.
- **Fetch Movie Details**: Fetch movie details, including download links and quality, from a given movie URL.
- **List Movies by Category**: List movies by category, such as Tamil HD Movies, Dubbed Movies, and Web Series.

## Installation

To use this project, you need to have [Node.js](https://nodejs.org/) installed. Install the required packages using npm:

```bash
npm install hacxk-movie-scrapper
```

## Usage

### Functions

#### 1. Search Movies

Search for movies by a keyword.

```javascript
const { hacxkMovieSearch } = require('hacxk-movie-scrapper');

async function searchMovies(query) {
    const result = await hacxkMovieSearch(query);
    console.log(JSON.stringify(result, null, 2));
}

// Example usage:
searchMovies('Lift');
```

#### 2. Fetch Movie Details

Fetch detailed information, including download links and quality, from a specific movie URL.

```javascript
const { hacxkMoviedl } = require('hacxk-movie-scrapper');

async function getMovieDetails(url) {
    const result = await hacxkMoviedl(url);
    console.log(JSON.stringify(result, null, 2));
}

// Example usage:
getMovieDetails('https://tamilyogi.beer/money-heist-s05-vol-2-2021-hd-720p-tamil-dubbed-series-watch-online/');
```

#### 3. List Movies by Category

List movies by category. The page number is optional.

```javascript
const { hacxkTamilMovie } = require('hacxk-movie-scrapper');

async function listMovies(option, pageNo) {
    const result = await hacxkTamilMovie(option, pageNo);
    console.log(JSON.stringify(result, null, 2));
}

// Example usage:
// Option 1: Tamil HD Movies
// Option 2: Dubbed Movies
// Option 3: Web Series

listMovies('1', '2');  // Fetches the second page of Tamil HD Movies
listMovies('2');       // Fetches the first page of Dubbed Movies
```

### Error Handling

The functions handle errors gracefully and return a structured JSON response with an error message if any error occurs during scraping.

### Example Error Response

```json
{
    "author": "HACXK",
    "github": "https://github.com/hacxk",
    "status": false,
    "results": "An error occurred while scraping TamilYogi."
}
```

### Notes

- Ensure the target URLs are accessible. The example URLs point to the TamilYogi website.
- This scraper uses a mobile user agent to fetch the content.
- The page number parameter in `hacxkTamilMovie` is optional.

## Contributing

Contributions are welcome! Feel free to open issues or pull requests on [GitHub](https://github.com/hacxk).

## License

This project is licensed under the ISC License.

## Author

- **HACXK**
- [GitHub](https://github.com/hacxk)

Feel free to contribute, raise issues, or suggest improvements. Happy scraping!