Scrape a Website and Build a Chatbot

Scrape real product data from a store and build an AI recommendation chatbot.

Introduction

30 Second Summary

Ever tried shopping for a laptop online and felt overwhelmed by hundreds of product listings? Imagine having a personal assistant that already knows every product in the store and can instantly answer questions like "What's the best laptop under my budget?"

In this project, you will build a Python web scraper that pulls real product data from a live computer store's website. Then you will create an AI-powered chatbot that uses that data to give personalized product recommendations.

What You'll Build

A two-part Python project that scrapes laptop and computer parts data from Alaqsa Computers (a real online store in Lahore, Pakistan), then feeds that data into a terminal chatbot powered by Google Gemini.

By the end of this project, you'll have:

  • A Python scraper script that fetches and parses product listings from a live e-commerce website.
  • A structured CSV file containing product names, prices, and links.
  • A terminal-based chatbot that uses Google Gemini to recommend products from the scraped inventory with multi-turn conversation support.
  • Secret Mission: Scrape multiple pages of the shop for a bigger product catalog, and add a budget filter feature to the chatbot.

Are there any prerequisites?

You need basic Python knowledge (variables, loops, and functions). No web scraping or AI experience is needed.

You also need Python 3.10 or higher installed on your computer, and a Google account to get a free Gemini API key.

Set Up Your Tools

Before you can build the scraper and chatbot, you need a working Python environment and a few key libraries.

In this step, you will create a project folder, install three Python packages, and grab a free API key for Google Gemini.

In this step, get ready to:
  • Verify that Python 3.10+ is installed and create a project folder.
  • Install the Requests, BeautifulSoup, and google-genai packages.
  • Get a free Gemini API key from Google AI Studio.
Create your project folder and verify Python
  • Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
  • Type Terminal (macOS) or PowerShell (Windows) and press Enter to open it.
  • Check your Python version by running this command:
python --version

✔️ I see a version number

Make sure the version is 3.10 or higher.

If it is, you are good to go.

ⓧ Command not found

On macOS, the command is often python3 instead of python.

  • Try running this command instead:
python3 --version

If that prints a version 3.10 or higher, use python3 everywhere this project says python.

If neither command works, download Python from python.org/downloads and run the installer.

  • Move to your Desktop by running this command:
cd ~/Desktop
  • Create your project folder and move into it by running these commands:
mkdir alaqsa-bot
cd alaqsa-bot
  • Confirm you are in the new folder by running:
pwd

You should see a path ending in alaqsa-bot.

Don't see alaqsa-bot?

If mkdir returned an error, the folder might already exist from a previous attempt. Run cd alaqsa-bot on its own and try pwd again.

If cd ~/Desktop failed on Windows Command Prompt, open PowerShell instead. The ~/ shortcut only works in PowerShell and macOS Terminal.

Help me troubleshoot my project folder setup.

Install the Python packages

This project uses three libraries that do not come with Python by default. You need to install them with pip, Python's package manager.

  • Install all three packages by running this command:
pip install requests==2.33.1 beautifulsoup4==4.14.3 google-genai==1.73.1

What do these packages do?

  • requests fetches web pages as raw HTML. You will use it to download the Alaqsa Computers homepage.
  • beautifulsoup4 parses that HTML so you can extract specific pieces of data using CSS selectors.
  • google-genai is Google's official Python SDK for the Gemini AI API. It powers the chatbot you will build in a later step.
  • You should see Successfully installed followed by the three package names near the end of the output.

Seeing an error during install?

  • If you see pip: command not found, try pip3 install instead of pip install. On macOS, the command is often pip3.
  • If you see a permissions error, add --user to the end of the command to install the packages for your user account only.
  • If the install hangs or times out, check your internet connection and try again.

Help me fix my pip install error.

Get your free Gemini API key

The chatbot you will build later needs to talk to the Gemini API. To authenticate your requests, you need an API key.

The Gemini API has a free tier that does not require a credit card. It takes about 30 seconds to get a key.

  • Open Google AI Studio in your browser.
  • Sign in with your Google account.
  • Click Create API Key.
  • If prompted to choose a project, select Create API key in new project.
  • Copy the API key and save it somewhere safe, like a text file or a notes app. You will paste it into your code in a later step.

What is an API key?

An API key is a unique string that identifies your application to Google's servers. When your chatbot sends a message to Gemini, the API key proves you have permission to use the service.

Treat it like a password. Do not share it publicly or commit it to a public repository.

Having trouble creating a key?

Make sure you are signed into a personal Google account. Some school or work accounts restrict access to Google AI Studio.

Help me get my Gemini API key.

Your environment is ready. Next up, you will inspect a real website's HTML structure and scrape product data from it.

Scrape Product Data from Alaqsa Computers

Your tools are installed and your API key is saved. Now it's time to put them to work on a real website.

In this step, you'll scrape product data from Alaqsa Computers, an online computer store based in Lahore, Pakistan. You'll inspect the website's HTML structure, extract the data you need with Python, and save it to a CSV file.

In this step, get ready to:
  • Inspect the HTML structure of alaqsa.com.pk to find product data patterns.
  • Write a Python scraper that extracts product names, prices, and links.
  • Run the scraper and save the results to a CSV file.
Inspect the website HTML structure

Every web scraper starts with detective work. Before writing code, you need to understand how the target website organizes its product data in HTML.

  • Open https://www.alaqsa.com.pk/ in your browser.
  • Right-click on any product name on the page.
  • Select Inspect to open your browser's Developer Tools.

The Developer Tools panel shows the raw HTML behind the page. Look at the highlighted element and explore the code around it.

What is WooCommerce?

Alaqsa Computers runs on WooCommerce, a popular e-commerce plugin for WordPress. WooCommerce uses standardized HTML class names for product listings, which makes scraping predictable.

Here are the HTML patterns you should look for as you explore the Developer Tools:

  • Each product sits inside an <li> element with a class of product.
  • The product name is in a heading tag with class woocommerce-loop-product__title.
  • The price sits inside a <span> with class price. Individual amounts use the class woocommerce-Price-amount.
  • Sale items have the original price wrapped in a <del> tag and the sale price wrapped in an <ins> tag.

Verify the class names yourself

Website themes can customize these class names. Click around different products in the Developer Tools to confirm the classes match what's listed above. This habit of verifying selectors before coding is a core web scraping skill.

Write the scraper script

Now that you know the HTML patterns, you can write code to extract the data automatically. You'll build the scraper in three parts: fetching the page, extracting product data, and saving it to a file.

Why BeautifulSoup and Requests?

BeautifulSoup is the most beginner-friendly Python scraping library. Combined with Requests, it requires minimal setup and teaches core HTML parsing concepts that transfer to any scraping tool.

Alternatives like Scrapy are more powerful but overkill for scraping a single page. Playwright and Selenium are designed for JavaScript-rendered pages, which is unnecessary here since Alaqsa serves static HTML.

  • Create a new file called scraper.py in your alaqsa-bot folder.
  • Add the following code to fetch and parse the Alaqsa Computers homepage:
import requests
from bs4 import BeautifulSoup
import csv

# Target URL for scraping
url = "https://www.alaqsa.com.pk/"

# Fetch the page and check for errors
print("Fetching Alaqsa Computers homepage...")
response = requests.get(url)
response.raise_for_status()

# Parse the raw HTML into a searchable tree
soup = BeautifulSoup(response.text, "html.parser")

# Empty list to collect product data
products = []

What does this code do?

  • requests.get(url) fetches the raw HTML from the Alaqsa Computers homepage, just like your browser does when you visit a page.
  • response.raise_for_status() throws an error if the page fails to load (like a 404 or server error). This stops the script early instead of silently continuing with bad data.
  • BeautifulSoup(response.text, "html.parser") turns the raw HTML string into a tree structure you can search using CSS selectors.
  • Save scraper.py.

You won't see any output yet. The next chunk adds the code that extracts product data from the parsed HTML.

Getting a connection error?

  • Make sure you have an active internet connection.
  • Check that the URL is exactly https://www.alaqsa.com.pk/ with the trailing slash.
  • If the site is temporarily down, wait a minute and try again.

Why can't my script connect to the website?

  • In scraper.py, add the following code below the products = [] line to loop through each product and extract its data:
# Loop through every product card on the page
for product in soup.select("li.product"):
    # Extract the product name
    name_tag = product.select_one(".woocommerce-loop-product__title")
    if not name_tag:
        continue
    name = name_tag.get_text(strip=True)

    # Extract the price container
    price_tag = product.select_one(".price")
    if not price_tag:
        continue

    # Check if the product is on sale (ins = sale price, del = original price)
    sale_tag = price_tag.select_one("ins .woocommerce-Price-amount")
    original_tag = price_tag.select_one("del .woocommerce-Price-amount")

    if sale_tag:
        current_price = sale_tag.get_text(strip=True)
        original_price = original_tag.get_text(strip=True) if original_tag else ""
    else:
        # Not on sale, grab the regular price
        regular_tag = price_tag.select_one(".woocommerce-Price-amount")
        current_price = regular_tag.get_text(strip=True) if regular_tag else "Call for Price"
        original_price = ""

    # Extract the product page link
    link_tag = product.select_one("a[href]")
    link = link_tag["href"] if link_tag else ""

    # Add this product to the list
    products.append({
        "name": name,
        "current_price": current_price,
        "original_price": original_price,
        "link": link,
    })

What does this code do?

  • soup.select("li.product") finds every product card on the page using the CSS selector you verified in the Developer Tools.
  • For each product, the code grabs the name from .woocommerce-loop-product__title and the price from .price.
  • The if sale_tag block handles two cases: sale items (where the current price is inside <ins>) and regular items (where the price sits directly in .woocommerce-Price-amount).
  • products.append({...}) adds each product as a dictionary with four keys: name, current_price, original_price, and link.
  • Save scraper.py.

Still no visible output yet. The next chunk writes the extracted data to a CSV file and prints a preview.

  • Below the for loop you just added, paste the following code to save the scraped products to a CSV file and print a preview:
# Write all products to a CSV file
with open("products.csv", "w", newline="", encoding="utf-8") as f:
    writer = csv.DictWriter(
        f, fieldnames=["name", "current_price", "original_price", "link"]
    )
    writer.writeheader()
    writer.writerows(products)

# Print a summary and preview the first 5 products
print(f"Done! Scraped {len(products)} products and saved to products.csv")
print("\nFirst 5 products:")
for p in products[:5]:
    print(f"  {p['name']} - {p['current_price']}")

What does this code do?

  • csv.DictWriter creates a CSV writer that maps each dictionary key to a column. The fieldnames list defines the column headers.
  • writeheader() writes the column names as the first row. writerows(products) writes every product dictionary as a row in the file.
  • The print statements give you a quick summary of how many products were scraped and a preview of the first five.
  • Save scraper.py.

Your scraper is complete. You'll run it in the next substep to see the results.

✔️ Awesome, I've got everything!

Great. Double check you've saved scraper.py before moving on.

ⓧ I'd like to double check the full code

Here is the complete scraper.py file. Make sure yours matches exactly.

import requests
from bs4 import BeautifulSoup
import csv

url = "https://www.alaqsa.com.pk/"

print("Fetching Alaqsa Computers homepage...")
response = requests.get(url)
response.raise_for_status()

soup = BeautifulSoup(response.text, "html.parser")

products = []

for product in soup.select("li.product"):
    name_tag = product.select_one(".woocommerce-loop-product__title")
    if not name_tag:
        continue
    name = name_tag.get_text(strip=True)

    price_tag = product.select_one(".price")
    if not price_tag:
        continue

    sale_tag = price_tag.select_one("ins .woocommerce-Price-amount")
    original_tag = price_tag.select_one("del .woocommerce-Price-amount")

    if sale_tag:
        current_price = sale_tag.get_text(strip=True)
        original_price = original_tag.get_text(strip=True) if original_tag else ""
    else:
        regular_tag = price_tag.select_one(".woocommerce-Price-amount")
        current_price = regular_tag.get_text(strip=True) if regular_tag else "Call for Price"
        original_price = ""

    link_tag = product.select_one("a[href]")
    link = link_tag["href"] if link_tag else ""

    products.append({
        "name": name,
        "current_price": current_price,
        "original_price": original_price,
        "link": link,
    })

with open("products.csv", "w", newline="", encoding="utf-8") as f:
    writer = csv.DictWriter(
        f, fieldnames=["name", "current_price", "original_price", "link"]
    )
    writer.writeheader()
    writer.writerows(products)

print(f"Done! Scraped {len(products)} products and saved to products.csv")
print("\nFirst 5 products:")
for p in products[:5]:
    print(f"  {p['name']} - {p['current_price']}")
Run the scraper and verify the output

Time to see the scraper in action. Running the script fetches real data from the live Alaqsa Computers website and saves it to your project folder.

  • Run the scraper by executing this command in your terminal:
python scraper.py

What should I see?

You should see output like this:

Fetching Alaqsa Computers homepage...

Followed by Done! Scraped X products and saved to products.csv (where X is the number of products on the homepage), plus a preview of the first 5 products with their names and prices in PKR.

  • Confirm the CSV file was created by running:
ls
  • You should see products.csv and scraper.py in the output.
  • Open products.csv in a text editor or spreadsheet app to verify the data.
  • You should see columns for name, current_price, original_price, and link filled with real product data from the Alaqsa Computers website.

Scraper returned 0 products?

  • Check that the CSS selectors in your code match the actual HTML on the page. Open the website in your browser, right-click a product, and select Inspect to compare class names.
  • Make sure li.product in your soup.select() call matches exactly what you see in the HTML. Class names are case-sensitive.
  • If the website recently changed its layout, the HTML class names may have changed. Use the Developer Tools to find the updated class names and adjust your selectors.

Why is my scraper finding 0 products on the page?

Seeing a SyntaxError or IndentationError?

  • Python is strict about indentation. Make sure every line inside the for loop and with block is indented with 4 spaces.
  • Check that all opening quotes and brackets have a matching closing one. The f-strings in the print statements use both single and double quotes.
  • Use the double-check tab above to compare your code against the full working version.

Help me fix a Python syntax error in my scraper script.

Your scraped data is saved and ready to go. Next up, you'll feed this product catalog to Google Gemini and build an AI chatbot that recommends products from the inventory.

Build the Recommendation Chatbot

Your scraper has done its job. You have a products.csv file packed with real product data from Alaqsa Computers.

Raw data in a spreadsheet is useful, but it is not exactly fun to browse. In this step, you'll build a terminal chatbot powered by Google Gemini that reads your scraped inventory and recommends products through natural conversation.

In this step, get ready to:
  • Load the scraped CSV data and format it for the AI.
  • Connect to the Gemini API and create a chat session with a system instruction.
  • Build an interactive chat loop in your terminal.
Load and format the product data

Before the AI can recommend products, it needs to understand what is available. You'll load your CSV file into Python and format each product into a readable text block.

  • Create a new file called chatbot.py in your alaqsa-bot folder and paste the following code:
import csv
from google import genai
from google.genai import types

# Load scraped product data
products = []
with open("products.csv", "r", encoding="utf-8") as f:
    reader = csv.DictReader(f)
    for row in reader:
        products.append(row)

# Format products as text for the AI
product_list = ""
for p in products:
    price_info = p["current_price"]
    if p["original_price"]:
        price_info = f"{p['current_price']} (was {p['original_price']})"
    product_list += f"- {p['name']} | Price: {price_info} | Link: {p['link']}\n"

What does this code do?

  • csv.DictReader reads each row of products.csv as a dictionary, using the header row as keys (name, current_price, etc.).
  • The formatting loop builds a single text string (product_list) where each product is one readable line with its name, price, and link.
  • Products on sale show both the current and original price so the AI can mention discounts.
  • Save chatbot.py.

You won't see any output yet. The next section connects this data to the AI.

Set up the Gemini client and system instruction

A system instruction tells the AI who it is and what data it has access to. This is how you keep the chatbot grounded in your real product inventory instead of making things up.

  • In chatbot.py, add this code below the formatting loop:
# Create the system instruction with product data
system_instruction = f"""You are a helpful computer parts recommendation assistant for Alaqsa Computers, a store in Lahore, Pakistan.

You have access to the following product inventory scraped from their website. Use ONLY this data to make recommendations. Do not make up products that are not in the list.

If a customer asks for something not in the inventory, let them know it is not currently available and suggest the closest alternative from the inventory.

Always include the product name, price in PKR, and the product link when making recommendations.

When comparing products, organize your response in a clear format.

PRODUCT INVENTORY:
{product_list}"""

# Set up the Gemini client
client = genai.Client(api_key="your-api-key-here")

# Create a chat session with the system instruction
chat = client.chats.create(
    model="gemini-2.5-flash",
    config=types.GenerateContentConfig(
        system_instruction=system_instruction,
    ),
)
  • Replace your-api-key-here with the Gemini API key you saved in Step 1.

What does this code do?

  • system_instruction is a large f-string that embeds the entire formatted product list directly into the prompt. Every time the AI responds, it has the full inventory to reference.
  • genai.Client() connects to the Gemini API using your key.
  • client.chats.create() starts a chat session with gemini-2.5-flash. The GenerateContentConfig passes your system instruction so the model knows its role from the very first message.

What is a system instruction?

A system instruction is a set of rules you give the AI before any user messages. It shapes how the AI behaves for the entire conversation.

In this case, the system instruction tells Gemini to only recommend products from the scraped inventory. Without it, the AI might invent products that don't exist on the Alaqsa website.

  • Save chatbot.py.

You won't see any output yet. The chat loop in the next section brings everything together.

Keep your API key safe

Your API key is pasted directly in the code for simplicity. Never share this file publicly or commit it to a public repository. In production, you would store the key in an environment variable instead.

Create the interactive chat loop

The chat session is ready, but it needs a way to take your questions and show responses. A simple while True loop handles this by reading your input, sending it to Gemini, and printing the reply.

  • In chatbot.py, add this code below the chat session you just created:
print("=" * 50)
print("  Alaqsa Computers Recommendation Bot")
print("  Ask me about laptops and computer parts!")
print('  Type "quit" to exit.')
print("=" * 50)

# Chat loop
while True:
    user_input = input("\nYou: ").strip()
    if user_input.lower() in ["quit", "exit", "q"]:
        print("\nThanks for chatting! Visit alaqsa.com.pk for more.")
        break
    if not user_input:
        continue

    response = chat.send_message(user_input)
    print(f"\nBot: {response.text}")

What does this code do?

  • The five print() lines display a welcome banner when the chatbot starts.
  • input("\nYou: ") waits for the user to type a message. .strip() removes any extra whitespace.
  • chat.send_message() sends your question to Gemini. The chat session automatically remembers all previous messages, so follow-up questions work naturally.
  • Typing quit, exit, or q breaks out of the loop and ends the program.
  • Save chatbot.py.
  • Run the chatbot by running this command:
python chatbot.py

You should see the welcome banner with "Alaqsa Computers Recommendation Bot" and a You: prompt waiting for your input.

Seeing an error when you run the chatbot?

  • FileNotFoundError for products.csv: Make sure you are running the command from inside the alaqsa-bot folder where products.csv lives.
  • Invalid API key error: Double check that you replaced your-api-key-here with your actual Gemini API key. Make sure there are no extra spaces or missing quotes around the key.
  • ModuleNotFoundError for google.genai: Run pip install google-genai again to make sure the package is installed.

Still stuck? Ask for help here.

✔️ Awesome, I've got everything!

Great. Double check you've saved chatbot.py and that the welcome banner appeared in your terminal.

ⓧ I'd like to double check the full code

Here is the complete chatbot.py file. Compare it against yours and make sure everything matches.

import csv
from google import genai
from google.genai import types

# Load scraped product data
products = []
with open("products.csv", "r", encoding="utf-8") as f:
    reader = csv.DictReader(f)
    for row in reader:
        products.append(row)

# Format products as text for the AI
product_list = ""
for p in products:
    price_info = p["current_price"]
    if p["original_price"]:
        price_info = f"{p['current_price']} (was {p['original_price']})"
    product_list += f"- {p['name']} | Price: {price_info} | Link: {p['link']}\n"

# Create the system instruction with product data
system_instruction = f"""You are a helpful computer parts recommendation assistant for Alaqsa Computers, a store in Lahore, Pakistan.

You have access to the following product inventory scraped from their website. Use ONLY this data to make recommendations. Do not make up products that are not in the list.

If a customer asks for something not in the inventory, let them know it is not currently available and suggest the closest alternative from the inventory.

Always include the product name, price in PKR, and the product link when making recommendations.

When comparing products, organize your response in a clear format.

PRODUCT INVENTORY:
{product_list}"""

# Set up the Gemini client
client = genai.Client(api_key="your-api-key-here")

# Create a chat session with the system instruction
chat = client.chats.create(
    model="gemini-2.5-flash",
    config=types.GenerateContentConfig(
        system_instruction=system_instruction,
    ),
)

print("=" * 50)
print("  Alaqsa Computers Recommendation Bot")
print("  Ask me about laptops and computer parts!")
print('  Type "quit" to exit.')
print("=" * 50)

# Chat loop
while True:
    user_input = input("\nYou: ").strip()
    if user_input.lower() in ["quit", "exit", "q"]:
        print("\nThanks for chatting! Visit alaqsa.com.pk for more.")
        break
    if not user_input:
        continue

    response = chat.send_message(user_input)
    print(f"\nBot: {response.text}")

Your chatbot is alive and connected to real product data. Next up, you'll put it through its paces with different types of queries and multi-turn conversations.

Test Your Chatbot

In the previous step, you wired up your scraped product data to Google Gemini and built an interactive chat loop. The code is ready to go.

Time to put your chatbot to the test. You'll try basic product queries, multi-turn conversations, and edge cases to see how well the AI stays grounded in your real inventory data.

In this step, get ready to:
  • Run the chatbot and test basic product queries.
  • Test multi-turn conversations and edge cases.
Run the chatbot and try basic queries
  • Start the chatbot by running this command:
python chatbot.py

You should see a welcome banner that says Alaqsa Computers Recommendation Bot along with instructions to type quit to exit.

Chatbot not starting?

  • If you see FileNotFoundError: products.csv, you need to run python scraper.py first to generate the CSV file.
  • If you see an API key not valid error, double-check that you pasted your Gemini API key correctly in chatbot.py where it says your-api-key-here.
  • If you see ModuleNotFoundError, run the install command from Step 1 again: pip install requests beautifulsoup4 google-genai.
  • Help me debug my chatbot startup error.

The chatbot is now waiting for your input at the You: prompt. Try asking it some questions about the product inventory.

  • Type What laptops do you have under 100,000 PKR? and press Enter.
  • Try I need a gaming laptop. What do you recommend?
  • Try What's the cheapest laptop available?

What should I see?

For each query, the AI responds with product names, prices in PKR, and direct links to the product pages on alaqsa.com.pk.

Notice that every product the AI mentions actually exists in your products.csv file. The AI is not making up products because the system instruction tells it to only use the provided inventory. This is the power of grounding an LLM with real data.

Test multi-turn conversations and edge cases

The Gemini chat session remembers everything you've said so far. This means you can ask follow-up questions that reference previous messages without repeating yourself.

  • Type Show me HP laptops and press Enter.
  • After you get a response, follow up with Which of those is best for a student?

How does the chatbot remember context?

Your follow-up says "those" without specifying HP laptops again. The AI understands what you mean because the client.chats.create() method keeps track of the full conversation history.

Every message you send and every response the AI gives is stored in the chat session. Gemini uses that full history to understand each new message in context.

Now test how the chatbot handles requests it cannot fulfill from the scraped inventory.

  • Ask for something that is probably not in the inventory: Do you have any desktop computers?
  • Try a product comparison: Compare the Lenovo and HP options

What happens with out-of-inventory requests?

When you ask about items that are not in the scraped data, the AI tells you they are not available. It then suggests the closest alternatives from your products.csv inventory.

This behavior comes directly from the system instruction you wrote in the previous step. The line "Do not make up products that are not in the list" keeps the AI honest. This is a core prompt engineering technique for building trustworthy AI applications.

  • Type quit to exit the chatbot when you are done testing.

You should see a goodbye message: Thanks for chatting! Visit alaqsa.com.pk for more.

Secret mission

Expand the Catalog and Add Budget Filtering

Your scraper only pulls products from the Alaqsa homepage. What if you could scrape multiple pages for a much bigger product catalog and add a budget filter so users can narrow down by price?

Before you go

Clean Up Your Resources

This project runs entirely on your local machine, and the Gemini API free tier does not require a credit card. There are no ongoing costs to worry about.

Decide whether to keep your project files for future tinkering, or clean everything up.

Resources you used:

  • Project folder alaqsa-bot containing scraper.py, chatbot.py, and products.csv.
  • Python packages: requests, beautifulsoup4, and google-genai.
  • Google Gemini API key (free tier, no billing attached).

Keep everything running

No action needed. Choose this if you want to keep experimenting with the scraper or chatbot.

  • Your project files stay in the alaqsa-bot folder on your Desktop.
  • Your Gemini API key remains active on the free tier.
  • You can re-run python scraper.py or python chatbot.py any time.

Pause - I'll come back to this later

Free up installed packages while keeping your project files intact.

  • Your project files (scraper.py, chatbot.py, products.csv) are safe to leave in the alaqsa-bot folder.
  • Optionally uninstall the Python packages by running:
pip uninstall requests beautifulsoup4 google-genai -y
  • When you come back, re-install them with the same pip install command from Step 1.
  • Your Gemini API key stays active. No need to regenerate it.

Delete - I don't want to use this again

Remove all project files and uninstall packages completely.

  • Uninstall the Python packages by running:
pip uninstall requests beautifulsoup4 google-genai -y
  • Delete the project folder by running:
cd ~/Desktop
rm -rf alaqsa-bot

Mission accomplished

That's a Wrap!

Nice work! You just built a complete data pipeline that scrapes real product data from a live website and turns it into an AI-powered recommendation chatbot.

You've learned how to:

  • Scraped real product data from a live e-commerce website using Requests and BeautifulSoup.
  • Structured raw HTML into a clean CSV file using CSS selectors and Python's built-in csv module.
  • Built a multi-turn recommendation chatbot powered by the Google Gemini API that stays grounded in real scraped inventory data.
  • Secret Mission: Expanded the scraper to pull from multiple pages and added budget filtering to the chatbot.

Ready to quiz yourself?