๐ŸŒ AIๆœ็ดข & ไปฃ็† ไธป้กต
Skip to content

A Python web scraper that extracts detailed football match data from yallakora.com, providing a structured CSV output for easy analysis.

License

Notifications You must be signed in to change notification settings

khaledsoudy-1/football-fixtures-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โšฝ Football Fixtures Scraper

๐Ÿ“– Description

A robust Python web scraper that collects football match data from Yallakora for a specified date. The program extracts comprehensive match information including team names, scores, match status, time, round, and championship. It saves the data in a structured CSV format for easy analysis.

โœจ Features

  • Date-specific football match data scraping from Yallakora ๐Ÿ†โšฝ
  • Comprehensive match metrics including:
    • Team names
    • Match scores
    • Match status
    • Match time
    • Round number
    • Championship name
  • Robust error handling
  • Clean CSV output format
  • User-agent handling for reliable scraping

๐Ÿš€ How to Use

  1. Set up your environment:
    Make sure you have Python installed on your system.

  2. Install dependencies:
    Run the following command to install the necessary packages:

    pip install -r requirements.txt
  3. Run the Scraper:
    Execute the script:

    python main.py

    The script will:

    • Prompt you to enter a date (MM/DD/YYYY format)
    • Fetch the latest football match data for that date from Yallakora
    • Process the information
    • Generate a CSV file (football_fixtures.csv)
  4. View the Results: Open the generated football_fixtures.csv file in Excel:

    • Set the page layout from right to left to properly display the Arabic data
    • You may need to adjust column widths for optimal viewing

๐Ÿ“Š Example Output

CSV File (football_fixtures.csv)

ุงู„ุจุทูˆู„ุฉ ุฑู‚ู… ุงู„ุฌูˆู„ุฉ ู…ูˆุนุฏ ุงู„ู…ุจุงุฑุงุฉ ุงู„ุญุงู„ุฉ ุงู„ูุฑูŠู‚ ุงู„ุซุงู†ูŠ ู†ุชูŠุฌุฉ ุงู„ู…ุจุงุฑุงุฉ ุงู„ูุฑูŠู‚ ุงู„ุฃูˆู„
ุชุตููŠุงุช ุฃู…ู… ุฅูุฑูŠู‚ูŠุง ุงู„ุฌูˆู„ุฉ ุงู„ุซุงู„ุซุฉ 07:00:00 ู… ุงู†ุชู‡ุช ุงุซูŠูˆุจูŠุง 1 - 4 ุบูŠู†ูŠุง
ุชุตููŠุงุช ุฃู…ู… ุฅูุฑูŠู‚ูŠุง ุงู„ุฌูˆู„ุฉ ุงู„ุซุงู„ุซุฉ 10:00:00 ู… ุงู†ุชู‡ุช ุฃูุฑูŠู‚ูŠุง ุงู„ูˆุณุทู‰ 0 - 5 ุงู„ู…ุบุฑุจ
ุจุทูˆู„ุฉ ุฅูุฑูŠู‚ูŠุง ู„ู„ุฃู†ุฏูŠุฉ ู„ูƒุฑุฉ ุงู„ูŠุฏ ุงู„ูŠูˆู… ุงู„ุซุงู„ุซ 07:00:00 ู… ุงู†ุชู‡ุช ุฃุฏุฌูŠุฏุฌุง 43 - 25 ุขุณูุง

Note: The table above is displayed from right to left to match the Arabic text direction.

๐Ÿ’ป Code Highlights

Error Handling

def fetch_page_content(url):
    """Fetches the HTML content of a given URL."""
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
    }
    try:
        page = requests.get(url, headers=headers, timeout=5)
        page.raise_for_status()
        return page.content
    except requests.exceptions.HTTPError as http_error:
        print(f"HTTP error occurred: {http_error}")
    # ... more error handling

๐Ÿ› ๏ธ Potential Enhancements

  • Add command-line arguments for custom output file names
  • Implement data comparison with historical records
  • Add data visualization capabilities
  • Create a simple web interface using Flask
  • Add automated scheduling for regular data updates
  • Implement data validation and cleaning
  • Add support for different output formats (JSON, Excel)
  • Include data visualization exports

๐Ÿ‘จโ€๐Ÿ’ป Author

Khaled Soudy

๐Ÿงฑ Project Structure

football-fixtures-scraper/
โ”œโ”€โ”€ main.py          # Main script with scraping logic
โ”œโ”€โ”€ requirements.txt # Project dependencies
โ”œโ”€โ”€ .gitignore       # Git ignore file
โ””โ”€โ”€ README.md        # Project documentation

๐Ÿ“ฆ Dependencies

The project relies on the following Python packages:

  • beautifulsoup4==4.12.3
  • certifi==2024.8.30
  • charset-normalizer==3.4.0
  • idna==3.10
  • lxml==5.3.0
  • requests==2.32.3
  • soupsieve==2.6
  • tabulate==0.9.0
  • urllib3==2.2.3

โš ๏ธ Disclaimer

Please ensure you follow Yallakora's robots.txt and terms of service when using this scraper. Be respectful of the website's resources and implement appropriate delays between requests if needed.

๐Ÿ“ž Support

If you encounter any issues or have questions, please open an issue in the GitHub repository.

๐Ÿค Contributing

Contributions are welcome! Feel free to submit pull requests or open issues to improve the project.

๐Ÿ“„ License

This project is open source and available under the MIT License.


Stay updated with the latest football fixtures from Yallakora! โšฝ๐Ÿ“Š

Releases

No releases published

Packages

No packages published

Languages