This Python script is a web scraper that fetches data from a specified API and stores it in a CSV file. It is designed to extract product information, including product name, details, sale price, and links.
Before running the script, make sure you have the following:
- Python 3.x installed on your system.
-
Clone the repository to your local machine:
git clone https://github.com/GiorgosIlia/API-Scrapper.git
-
Navigate to the project directory:
cd API-Scrapper
-
Install the required Python libraries from the
requirements.txt
file:pip install -r requirements.txt
This will install the necessary libraries, including requests
for making HTTP requests and csv
for handling CSV files.
-
Open the
scraper.py
file and fill out the following placeholders with appropriate values:querystring
: Replace"fill out with appropriate values"
with the actual query parameters for the API.headers
: Fill out the"cookie"
and"User-Agent"
fields with the appropriate values for your use case.
-
Run the script:
python scraper.py
The script will make a request to the specified API, extract product data, and save it to a CSV file named file.csv
.
The script will create a CSV file file.csv
in the project directory, containing the following columns:
Product Name
: The name of the product.Product Details
: Additional details about the product.Sale Price
: The sale price of the product.Link
: The link to the product page.
If you'd like to contribute to this project, please follow the standard GitHub workflow:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with clear and concise messages.
- Push your branch to your fork.
- Create a pull request to merge your changes into the main repository.
If you encounter any issues or have suggestions for improvements, please open an issue on the Issues page.
Happy scraping!