News Feed Forums General Web Scraping How to scrape ticket details from SeatGeek.com using JavaScript?

  • How to scrape ticket details from SeatGeek.com using JavaScript?

    Posted by Nekesa Wioletta on 12/20/2024 at 12:02 pm

    Scraping ticket details from SeatGeek.com using JavaScript can help you collect information like event names, ticket prices, and locations. Using Node.js with Puppeteer, you can automate browser interactions to handle dynamic content and extract the required data. Below is a sample script for scraping ticket information from SeatGeek.

    const puppeteer = require('puppeteer');
    (async () => {
        const browser = await puppeteer.launch({ headless: true });
        const page = await browser.newPage();
        const url = 'https://seatgeek.com/concert-tickets';
        await page.goto(url, { waitUntil: 'networkidle2' });
        const tickets = await page.evaluate(() => {
            const ticketList = [];
            const items = document.querySelectorAll('.event-card');
            items.forEach(item => {
                const event = item.querySelector('.event-title')?.textContent.trim() || 'Event not available';
                const price = item.querySelector('.ticket-price')?.textContent.trim() || 'Price not available';
                const location = item.querySelector('.event-location')?.textContent.trim() || 'Location not available';
                ticketList.push({ event, price, location });
            });
            return ticketList;
        });
        console.log(tickets);
        await browser.close();
    })();
    

    This script navigates to SeatGeek’s concert tickets page, waits for the content to load, and extracts event names, ticket prices, and locations. Pagination handling allows you to collect data from multiple pages. Randomizing request timing helps avoid detection by SeatGeek’s anti-scraping systems.

    Nekesa Wioletta replied 2 days, 12 hours ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.