This is a fixed and improved version of the Xbox games scraper that properly returns a list of games from the Xbox store.
The original scraper used outdated selectors that didn't work with the modern Xbox website. The fixed version uses multiple fallback selectors:
a[href*="/games/store/"]- Main game store links[class*="ProductCard"] a- Product card linksa[data-m*="productCard"]- Data attribute-based links
- Wait for games to load: Added explicit waits for game cards to appear
- Handle dynamic content: Implemented scrolling and "Load more" button clicking
- Pagination handling: Automatically loads additional games
- Multiple fallback selectors: Each data field has multiple selector options
- Error handling: Safe text extraction that doesn't crash on missing elements
- Data cleaning: Removes price information from game titles
The fixed scraper includes a scrape_xbox_games() function that:
- Returns a list of dictionaries containing game data
- Can be imported and used in other scripts
- Configurable options for limit and headless mode
Added options to avoid detection:
--disable-blink-features=AutomationControlled--disable-automation- User agent rotation capabilities
- Install dependencies:
pip install -r requirements.txt- Install Chrome browser (if not already installed)
from xbox_scraper import scrape_xbox_games
# Get 50 games
games = scrape_xbox_games(limit=50)
# Print results
for game in games:
print(f"{game['title']} - {game['price']}")# Get more games with visible browser
games = scrape_xbox_games(limit=100, headless=False)
# Filter games by price
free_games = [g for g in games if 'Free' in g['price']]
paid_games = [g for g in games if '$' in g['price']]
# Save to custom CSV file
save_to_csv(games, "my_xbox_games.csv")python3 xbox_scraper.pyEach game in the returned list contains:
{
"title": "Game Title",
"link": "https://www.xbox.com/en-US/games/store/...",
"description": "Game description...",
"price": "$29.99" or "Free",
"publisher": "Publisher Name",
"release_date": "MM/DD/YYYY",
"platforms": "Xbox One, Xbox Series X|S"
}The scraper will:
- Create an
xbox_games.csvfile with all scraped data - Return a list of dictionaries for programmatic use
- Log progress and any errors encountered
The fixed version includes comprehensive error handling:
- Graceful handling of failed page loads
- Fallback data for missing information
- Detailed logging for debugging
- Continues scraping even if individual games fail
- Disables image loading for faster scraping
- Configurable delays to be respectful to the server
- Efficient scrolling and pagination handling
- Memory-conscious operation
If you encounter issues:
- Chrome driver issues: The script auto-downloads the correct ChromeDriver
- Timeout errors: Increase wait times in the
WebDriverWaitcalls - No games found: Check if Xbox changed their website structure
- Rate limiting: Add longer delays between requests
This scraper is for educational purposes only. Please respect Xbox's robots.txt and terms of service. Use responsibly and don't overload their servers.