GitHunt
AB

Abdullah321Umar/CodeAlpha_Web-Scraping-Project1

๐Ÿ’  FIFA Web Scraping ๐Ÿ’  Automated Python script to scrape FIFA World Rankings from the official FIFA website. Uses Selenium to handle dynamic pages and BeautifulSoup for parsing HTML content. Collects team names, ranks, points, and other stats automatically. Stores the data in a structured CSV file for analysis or visualization.

๐ŸŒ FIFA Data Web Scraping Project 1 โšฝ

Python
Selenium
BeautifulSoup


๐Ÿ“ Project Overview

This project is an automated web scraping solution to extract FIFA World Rankings and team statistics from the official FIFA website.
The goal is to collect, clean, and store football data for analysis, visualization, or research purposes.

Key Highlights:

  • Automated extraction of FIFA rankings and team information
  • Data cleaning and structured storage using Pandas
  • Integration of Selenium and BeautifulSoup for dynamic content
  • Exporting data to CSV for easy analysis

๐Ÿ› ๏ธ Tools & Technologies

Technology Purpose
Python ๐Ÿ Scripting and data handling
Selenium โšก Browser automation for dynamic content
BeautifulSoup ๐Ÿฒ HTML parsing and data extraction
Pandas ๐Ÿ“Š Data structuring and CSV export
ChromeDriver ๐ŸŒ Browser control for Selenium
Jupyter Notebook ๐Ÿ““ Development and testing environment

๐Ÿงฉ Project Workflow

1๏ธโƒฃ Problem Identification

Manual extraction of FIFA rankings is time-consuming and prone to errors.
This project automates the process to:

  • Collect FIFA World Rankings
  • Capture team names, ranks, points, and country codes
  • Export the data in a structured format for analysis

2๏ธโƒฃ Web Scraping Strategy

Dynamic Content Handling

  • Use Selenium to open and interact with FIFAโ€™s dynamic pages
  • Wait for tables to fully load before parsing

HTML Parsing

  • Use BeautifulSoup to extract:
    • Team names ๐Ÿท๏ธ
    • Ranking positions ๐Ÿฅ‡๐Ÿฅˆ๐Ÿฅ‰
    • Points and statistics ๐Ÿ“Š

๐Ÿ”ง Code Structure

a) Importing Libraries

import time
import pandas as pd
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from bs4 import BeautifulSoup

b) Setting up Selenium WebDriver

service = Service("path_to_chromedriver.exe")
options = webdriver.ChromeOptions()
options.add_argument("--start-maximized")
driver = webdriver.Chrome(service=service, options=options)

c) Navigating FIFA Rankings Page

url = "https://www.fifa.com/fifa-world-ranking/"
driver.get(url)
time.sleep(5)  # Wait for dynamic content to load

d) Parsing Rankings Table

soup = BeautifulSoup(driver.page_source, "html.parser")
teams = []
for row in soup.find_all("tr", class_="ranking-row"):
    rank = row.find("td", class_="rank").text.strip()
    team = row.find("td", class_="team-name").text.strip()
    points = row.find("td", class_="points").text.strip()
    teams.append([rank, team, points])

e) Saving Data to CSV

df = pd.DataFrame(teams, columns=["Rank", "Team", "Points"])
df.to_csv("FIFA_Rankings.csv", index=False)

โšก Challenges & Solutions

Challenge Solution
Dynamic content loading Added time.sleep() and Selenium waits
Complex HTML structure Used browser inspect tools to locate elements
Missing data Added checks to skip empty rows
Large dataset Stored results in CSV for structured analysis

๐Ÿ“Š Output & Results

  • Successfully scraped all FIFA-ranked teams โœ…
  • Data exported to FIFA_Rankings.csv ๐Ÿ“‚

Top 5 Teams

Rank Team Points
1 Argentina 1841
2 France 1827
3 Brazil 1818
4 Belgium 1778
5 England 1769

๐Ÿš€ Future Improvements

  • Schedule automatic scraping for real-time updates
  • Visualize rankings using matplotlib or seaborn ๐Ÿ“ˆ
  • Store historical data in a database for trend analysis
  • Extend scraping to include team stats, goals, and player rankings

๐ŸŽฏ Learning Outcomes

  • Hands-on experience with Selenium and BeautifulSoup integration
  • Understanding dynamic web content and HTML parsing
  • Improved Python, automation, and data handling skills
  • Learned to handle real-world web scraping challenges

โœ… Conclusion

This project demonstrates the ability to automate FIFA ranking extraction, producing structured datasets for analysis or reporting.
It showcases skills in Python programming, web scraping, and data management, useful for sports analytics, data science, and research projects.


๐Ÿ”— Let's Connect:-

๐Ÿ’ผ LinkedIn: https://www.linkedin.com/in/abdullah-umar-730a622a8/

๐Ÿ’ผ Portfolio: https://linktr.ee/AbdullahUmar.DataAnalyst

๐Ÿ“ง Email: umerabdullah048@gmail.com


Task Statement:-

Preview


Screenshots / Demos:-

Show what the Code and Output look like.
Preview