How to find secrets in websites

Aditya Badola
2 min readApr 13, 2022

Some days ago I received an email from a company which offered me a discount voucher if I found all the hidden Easter egg images in their website. That is the sole motivation for this little project.

the motivation

So the idea is to gather all possible URLs from this website that are of interest to us, and can contain the image of the Easter egg. The library I use is BeautifulSoup in python, along with the following imports:

from bs4 import BeautifulSoup
import requests
import re

base_url = “https://www.bluminus.be"
parent_url = “https://www.bluminus.be/nl/prive/extras"

Here, I have initialized 2 URLs; the base URL is the one that can be provided as prefix to any subdirectory in this website’s pages. The parent URL is the one that contains the weblinks I want to extract.

# Get all weblinks from this parent url
html_text = requests.get(parent_url).text
soup = BeautifulSoup(html_text, ‘html.parser’)
links = []

for link in soup.findAll(‘a’, attrs={‘href’: re.compile(“/nl/prive/extras/*”)}):
links.append(link.get(‘href’))

This code finds all < a href…> tags that contain the string ““/nl/prive/extras/” which is a pattern of the webpages I noticed the Easter egg images were usually located in. Now I can parse through all these webpages and count the number of occurrences of images that contain the same predefined alt-text (can be some other common feature like class or id or even height values)

Inspecting the HTML tags of this Easter egg image on the webpage

The following code performs the counting task

count = 0

# Loop over all the pages of website
for extra in links:
if “http” not in extra:
extra_url = base_url+extra
else:
extra_url = extra

# Get HTML content of each page in the links list

html_text = requests.get(extra_url).text
soup = BeautifulSoup(html_text, ‘html.parser’)

# provide the unique alt-text that identifies these Easter egg images
image_list = soup.findAll(“img”, alt=”Paasei van de EXTRAS! Paaswedstrijd.”)
if len(image_list) > 0:
count = count + 1

print(count, “ Easter eggs in total”)

And there you have it! A web scraper to help you avoid manually searching multiple web pages in search of the same Easter egg image.

--

--

Aditya Badola

Data analytics enthusiast. Bioinformatics. Creative Writing. Photography. Black Mirror.