Sign inSign up

icklint/artist_scraper

By icklint

•Updated over 2 years ago

Dockerized web scraper fetching Nigerian artists' data from Wikipedia using Python for easy deploy.

Image
Developer tools
Data science
Web analytics
0

181

icklint/artist_scraper repository overview

⁠Nigerian Artists Web Scraper

This project is a web scraper that fetches data about Nigerian artists and their personalities from a Wikipedia page and saves it to a text file. The project is containerized using Docker for easy deployment and portability.

⁠Project Structure

The project consists of the following files:

  • artist_scrape.py: This is the main Python script that performs the web scraping.
  • requirements.txt: This file lists the Python dependencies that need to be installed.
  • Dockerfile: This file contains the instructions to build the Docker image for this project.

⁠How to Run the Project

⁠Step 1: Set Up Docker

Install Docker on your machine. You can access this link to download Docker: Docker Desktop Installation for Windows⁠. Familiarize yourself with Docker commands and concepts such as images, containers, and Dockerfiles.

Based on the OS you are running, you may require additional base configuration for your machine, especially if it's Windows. Check if WSL (Windows Subsystem for Linux) is present on your machine and follow the steps outlined in this link: Install WSL⁠.

⁠Step 2: Prepare All Files

Ensure that all necessary files (artist_scrape.py, requirements.txt, Dockerfile) are saved in the correct format and stored in one directory.

⁠Step 3: Build the Docker Image

Open a terminal or Windows PowerShell, navigate to the project directory, and build the Docker image using the following command:

docker build -t artist_scraper .

Note: artist_scraper is just the name of the image and can be renamed as needed.

⁠Step 4: Run the Docker Container

Run a Docker container from the image you just built using the following command:

docker run --rm -v C:\Users\DELL\Desktop\pyprojects\BDA\task2:/app artist_scraper  
#or 
docker run -p atirst_scraper 

This command mounts the local directory to the /app directory in the Docker container, ensuring the output file is saved to your local machine.

⁠Step 5: Verify the Results

To verify that the data was scraped and saved correctly, check the Nigerian_Artists.txt file in the specified directory on your local machine. The file should contain the scraped data about Nigerian artists and their personalities.

⁠Troubleshooting
  • Dockerfile Issues: Ensure that the Dockerfile is saved without any extension (e.g., .txt). This prevents errors during the build process.
  • Python Script: Make sure the Python script (artist_scrape.py) runs correctly on its own before introducing it into Docker. Any modifications to the Dockerfile, Python script, or requirements.txt will require rebuilding the Docker image.
⁠Additional Steps (Optional)

To push the Docker image to a container registry (e.g., Docker Hub), follow these steps:

  1. Log In to Docker Hub:

    docker login
    
  2. Tag the Docker Image:

    docker tag artist_scraper your_username/artist_scraper:latest
    
  3. Push the Docker Image:

    docker push your_username/artist_scraper:latest
    

Note: Replace your_username with your Docker Hub username.

This README provides a comprehensive guide to setting up, running, and troubleshooting the Nigerian Artists Web Scraper project using Docker.

Tag summary

Content type

Image

Digest

sha256:096597737…

Size

45.6 MB

Last updated

over 2 years ago

docker pull icklint/artist_scraper