Scraping Sephora and a Flask Querying Application

Posted on Feb 20, 2018

Photo by Eric Wüstenhagen


For my scraping project, I decided to scrape product reviews from Sephora's website. Sephora is known as a one stop shop for a person's beauty needs, offering various brands of skincare, makeup, haircare, body and fragrance products at every price point.

The website holds more than 300 brands, at least 5000 products and thousands of reviews. The site was relatively easy to scrape and I was able to finish scraping ahead of schedule. With a lot of time on my hands, I took the opportunity to challenge myself by building a querying application using Flask.

How to Scrape Sephora

There are three page levels that you need to go through to reach the reviews area. First is the brands list page, which contains all the brands. Next is the brand page, where we can see all the products that the brand sells in the website. The product page is last. It includes specific information about the product, as well as its reviews. The reviews were not scraped from the site but were taken from an API which can be accessed by using the product ID.


Scraping the brand names and links is straightforward, with the names wrapped in a tag with class "u-hoverRed u-db u-p1" and the href link within the same location.


The product names, on the other hand, come as a dictionary search result which can be found on the bottom of the brand page's source code. I used Python's re package to get the product link, name, ID and average rating.

It was easier to scrape the total number of reviews from the product page, that's why I decided to go a level deeper, despite already having the information I needed to access the reviews API.


The product ID will then be used to construct the link where we can get the reviews and reviewer information. The link structure can be found in the web browser's Inspect Element in the Network area. After that go to the row named "reviews.json" under the header tab. The API will provide a dictionary which can be digested using the json package. The review text and reviewer's skintype, skintone, haircolor and eyecolor are gathered here. Running my scraping program on 17 brands resulted in the accumulation of more than 80,000 reviews.

Querying Application using Flask

I built a Flask Application that shows the top rated products given the brand or physical trait. I think it is useful to know which products are highly rated for a group of people with specific traits.


The application has three main areas, namely, the inputs, results and plot pages. Instead of detailing l how each page works here, I’d encourage you to try the application out to see for yourself!

About Author

Ansel Andro Santos

Ansel has a Master in Applied Mathematics from Ateneo de Manila University. He worked in the investments industry before deciding to become a data scientist. His interest in data science started while making the factor based investment strategy...
View all posts by Ansel Andro Santos >

Related Articles

Leave a Comment

Manoj August 10, 2018
Can you provide the github link, please?
Hafsa April 14, 2018
Hi, could you please guide me step by step to scrape the reviews? I am very confused about the methods and step to take. I saw your github and tried to make sense, but I couldn't follow. I need to present scraped data for the Sephora site by Monday morning ;(
Hafsa Laeeque April 14, 2018
Hi, could you please guide me step by step to scrape the reviews? I am very confused about the methods and step to take. I saw your github and tried to make sense, but I couldn't follow. I need to present scraped data for the Sephora site by Monday morning ;(

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp