Metadata-Version: 2.1
Name: LinkedInWebscraper
Version: 1.0.0
Summary: A library for scraping LinkedIn job postings.
Home-page: https://github.com/ricardogr07/LinkedInWebScraper
Author: Ricardo García Ramírez
Author-email: rgr.5882@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests >=2.31.0
Requires-Dist: beautifulsoup4 >=4.12.3
Requires-Dist: pandas >=2.2.0
Requires-Dist: numpy >=1.26.4
Requires-Dist: openai >=1.43.0
Requires-Dist: python-dotenv >=1.0.1


# LinkedInWebScraper

LinkedInWebScraper is a Python library designed to simplify and automate the process of scraping job postings from LinkedIn. It provides a reusable, user-friendly solution that streamlines the entire scraping process from data extraction to cleaning and storage.

## Why Did I Create It?

Web scraping can be highly effective for gathering data, but setting up a custom scraper for each use case can be time-consuming and error-prone. 

LinkedInWebScraper was developed to tackle these challenges by offering a streamlined solution that saves time, simplifies workflows, and enhances productivity.

### Key Objectives of the Library:

- **Simplify the Setup**: Eliminate the need for boilerplate code, allowing users to focus on gathering and analyzing data.
- **Enhance Reusability**: Provide a flexible architecture that users can customize to fit their specific needs without rewriting the same code.
- **Facilitate Automation**: Automate the process of scraping job postings across multiple locations and keywords, enabling large-scale data collection with minimal effort.

---

## Built Upon Reliable Libraries

LinkedInWebScraper leverages several powerful Python libraries to ensure robust functionality and performance:

- **BeautifulSoup**: Used for parsing and navigating HTML content to extract meaningful job data, such as job titles, companies, locations, and descriptions.
  
- **Requests**: Handles HTTP requests and provides a simple, reliable way to make GET requests to LinkedIn's job search pages, customizing headers to avoid detection.
  
- **Pandas**: Structures and analyzes the scraped data, enabling users to manipulate large volumes of job postings, clean the data, and export it in formats such as CSV or JSON.

- **OpenAI API**: Integrated to process and classify job titles and descriptions, leveraging machine learning models to categorize job postings intelligently, enhancing filtering and accuracy.

Together, these libraries form the backbone of LinkedInWebScraper, ensuring performance, reliability, and adaptability for a wide range of data scraping needs.

---

## Overview of LinkedInWebScraper's Architecture

### High-Level Structure

LinkedInWebScraper follows a modular architecture based on Object-Oriented Programming (OOP), with each module responsible for a specific part of the scraping process. This design ensures flexibility, maintainability, and scalability as features or customizations are added.

### Main Components

1. **`LinkedInJobScraper` Class**:  
   The core class that orchestrates the entire scraping workflow. It coordinates the scraping, cleaning, classification, and enrichment of job postings.

2. **`JobScraper` Class**:  
   Handles interaction with LinkedInâ€™s job search pages, URL generation, pagination, and parsing job postings from HTML.

3. **`JobDataCleaner` Class**:  
   Processes raw job data scraped from LinkedIn, ensuring that the data is structured, consistent, and ready for analysis.

4. **`JobTitleClassifier` Class**:  
   Uses the OpenAI API to classify job titles and categorize postings based on specific fields like data science or software engineering.

5. **`JobScraperConfig` & `JobScraperConfigFactory` Classes**:  
   Manages configuration settings for the scraper, such as keywords, location, distance, and job type.

6. **`JobDescriptionProcessor` Class**:  
   Processes job descriptions, ensuring they are clean and standardized before being added to the dataset.

---

## Design Decisions

### Modularity

One of the central design principles behind LinkedInWebScraper is modularity. Each class and function has a well-defined responsibility, ensuring that the codebase is easy to understand, update, and extend.

### Error Handling

Web scraping is inherently prone to errors, and LinkedInWebScraper incorporates robust error-handling mechanisms.

### Scalability

LinkedInWebScraper was designed to handle large-scale data scraping efficiently.

## Installation

To install the LinkedInWebScraper library, run:

```bash
pip install LinkedInWebScraper
```

## Usage Example

Hereâ€™s an example of how to use LinkedInWebScraper to scrape job postings:

```python
from LinkedInWebScraper import LinkedInJobScraper, JobScraperConfig

# Define scraper configuration
config = JobScraperConfig(
    position="Data Scientist",
    location="San Francisco",
    remote="REMOTE"
)

# Initialize the scraper
scraper = LinkedInJobScraper(config=config)

# Scrape job data
job_data = scraper.run()

# View the results
print(job_data.head())
```

---

## Contributing

Contributions are welcome! Please feel free to submit issues or pull requests. 

## License

This project is licensed under the MIT License.

---

## Contact

For any questions or inquiries, please reach out!

- **LinkedIn**: [ricardogarciaramirez](https://www.linkedin.com/in/ricardogarciaramirez/)
- **Email**: [rgr.5882@gmail.com](mailto:rgr.5882@gmail.com)
- **Medium**: [@rgr5882](https://medium.com/@rgr5882)
- **X (Twitter)**: [ricardogr_dsc](https://x.com/ricardogr_dsc)
- **Kaggle**: [ricardogr07](https://www.kaggle.com/ricardogr07)
