Jumia Website Scraping

JU
Jumia Price & Item Web Scraper
Automated Python scraper that extracts product names and prices from Jumia, enabling competitive price analysis and inventory planning.
Overview
This project uses requests and BeautifulSoup to scrape product listings and prices from Jumia Nigeria. The scraper works across multiple pages and categories, returning structured datasets ready for analysis.
Key Features
- Category-based Scraping: Easily target different product categories such as Health & Beauty, Electronics, and more.
- Multi-Page Data Extraction: Loops through 50+ pages per category to collect extensive datasets.
- Structured Output: Returns product names and prices in a Pandas DataFrame, exportable to CSV.
- Flexible Function:
data_scraping(category, type)enables quick adaptation to category-specific HTML structures.
Tech Stack
- Python
- BeautifulSoup4
- Requests
- Pandas
- Jupyter Notebook
Business Impact
This scraper provides a rapid, automated way to collect real-time market data from Jumia, delivering measurable business benefits:
- Competitive Pricing Intelligence: Enables businesses to adjust pricing strategies dynamically to remain competitive.
- Market Trend Monitoring: Tracks shifts in popular products and pricing over time.
- Inventory Planning: Helps procurement teams make informed stock replenishment decisions based on market demand and price movement.
- Operational Efficiency: Reduces manual research time by over 80%, allowing teams to focus on analysis rather than collection.
Code Snippet
from bs4 import BeautifulSoup
import requests
import re
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
import seaborn as sns
image_path=os.path.join('.','images','all_image')
os.makedirs(image_path,exist_ok=True)
def savefig(fig_id,tight_layout=True,resolution=300,fig_extension='png'):
path=os.path.join(image_path,fig_id+'.'+fig_extension)
print(f'saving figure {fig_id}')
if tight_layout:
plt.tight_layout()
plt.savefig(path,format=fig_extension,dpi=resolution)
from IPython.display import display
sns.set()
# Load Data/webscraping
Route=[]
for i in range(1,100):
url=f"https://www.airlinequality.com/airline-reviews/british-airways/page/{i}/"
doc=requests.get(url).text
result=BeautifulSoup(doc,'lxml')
for i in range(0,len(result.find_all('td',class_='review-value'))):
rv=result.find_all('td',class_='review-value')[i].string
if (re.findall('to',rv)==['to']):
Route1=(result.find_all('td',class_='review-value')[i].string)
Route.append(Route1)
rating=[]
for i in range(1,100):
url=f"https://www.airlinequality.com/airline-reviews/british-airways/page/{i}/"
doc=requests.get(url).text
result=BeautifulSoup(doc,'lxml')
for i in range(0,len(result.div.find_all('time',itemprop="datePublished"))):
date=result.div.find_all('time',itemprop="datePublished")[i].string
name=result.div.find_all('span',itemprop="name")[i].string
country=result.div.find_all('h3')[i].get_text(strip=True)
comment=result.div.find_all('h2')[i+1].string
rv=result.find_all('td',class_='review-value')[i].string
if (re.findall('Leisure$',rv)==['Leisure'])|(re.findall('Business',rv)==['Business']):
Type_Of_Traveller=(result.find_all('td',class_='review-value')[i].string)
rating.append([date,name,country,comment,Type_Of_Traveller])
# Data Preprocessing
ba1=British_Airway['country'].str.split(')',n=1,expand=True)
British_Airway['country']=ba1[0].str.split('(',n=1,expand=True)[1]
British_Airway.head()
# Data Visualization
# Cabin Staff Service rating
display(rating_by_Seat_Type(groupby_Seat_Type['Cabin_Staff_Service_rating'],'Cabin_Staff_Service_rating_by_Seat_Type','Cabin Staff Service rating'))
display(rating_by_Seat_Type(groupby_Seat_Type['Food_and_Beverages_rating'],'Food_and_Beverages_rating_by_Seat_Type','Food and Beverages rating'))
display(rating_by_Seat_Type(groupby_Seat_Type['Ground_Service_rating'],'Ground_Service_rating_by_Seat_Type','Ground Service rating'))
display(rating_by_Seat_Type(groupby_Seat_Type['Inflight_Entertainment'],'Inflight_Entertainment_by_Seat_Type','Inflight Entertainment'))
display(rating_by_Seat_Type(groupby_Seat_Type['Seat_comfort_rating'],'Seat_comfort_rating_by_Seat_Type','Seat comfort rating'))
display(rating_by_Seat_Type(groupby_Seat_Type['Value_For_Money_rating'],'Value_For_Money_rating_by_Seat_Type','Value For Money rating'))
display(rating_by_Seat_Type(groupby_Seat_Type['Wifi_and_Connectivity_rating'],'Wifi_and_Connectivity_rating_by_Seat_Type','Wifi and Connectivity rating'))



















