Advanced Web Scraping Solution

Vasilis Gavresis

0

Backend Engineer

Fullstack Engineer

Software Engineer

Python

Selenium

An advanced web scraper built with Selenium and Python to automatically download and save slot game images from a casino website. It navigates to a specified page, and then scrapes image URLs from game items along with their game data .
Each image is downloaded and stored in a dynamically created local folder, organized by the provider name. The script was used to populate demo slots along with slot game data on https://wisespinner.com/games/
import os
import requests
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.service import Service
from webdriver_manager.firefox import GeckoDriverManager
from datetime import datetime

# Initialize the WebDriver for Firefox
driver = webdriver.Firefox(service=Service(GeckoDriverManager().install()))

# Define target URL and folder structure
TARGET_URL = "----"
IMAGE_FOLDER = "demo_slots"

def create_folder(provider_name):
"""Creates a folder named after the provider to store images."""
folder_path = os.path.join(os.getcwd(), IMAGE_FOLDER, provider_name)
if not os.path.exists(folder_path):
os.makedirs(folder_path)
print(f"[INFO] Created folder: {folder_path}")
return folder_path

def fetch_game_images(driver, folder_path):
"""Fetches images of slot games and saves them in the specified folder."""
game_elements = driver.find_elements(By.CLASS_NAME, 'game-item')
print(f"[INFO] Found {len(game_elements)} game items on the page.")

for game in game_elements:
try:
image = game.find_element(By.TAG_NAME, 'picture').find_element(By.TAG_NAME, 'img')
image_url = image.get_attribute('src').split('?')[0] # Clean up URL
img_name = image_url.split('/')[-1]
.....

Like this project
0

Posted Nov 6, 2024

An advanced web scraper built with Selenium and Python to extract slot games' images and data based on the provider

Likes

0

Views

0

Tags

Backend Engineer

Fullstack Engineer

Software Engineer

Python

Selenium

Vasilis Gavresis

Django Specialist, Fullstack Developer

Django Project | Custom Web Solutions
Django Project | Custom Web Solutions
Python Solutions
Python Solutions
Casino News, Slots, & Affiliate Hub  Wordpress Website
Casino News, Slots, & Affiliate Hub Wordpress Website