Prompt

Why is pagination not being followed in my scraper?

Technology / API Platforms2 observationsLast seen Oct 14, 2026

Latest observation

Oct 14, 2026OpenAI APIWeb search: off

Pagination usually “isn’t being followed” for one of these reasons:

1) The site loads pages with JavaScript

If the next-page content is fetched dynamically in the browser, a simple requests/BeautifulSoup scraper will only see the initial HTML.
Check: Open page source vs. browser dev tools → Network tab.
Fix: Use the site’s underlying API endpoint, or a browser automation tool like Playwright/Selenium.

2) You’re not updating the page URL or request parameter correctly

Often pagination is driven by:

  • ?page=2
  • /page/2/
  • offset=20
  • a “next” token/cursor

If your scraper keeps requesting the same URL, it will keep getting the first page.
Check: Log each request URL you make.

3) Your “next page” selector is wrong

The HTML element you’re clicking/extracting may not be the real next link, or it may be disabled on the first page.
Check: Print the extracted href/text for the next button/link.

4) Relative URLs aren’t being resolved correctly

A link like /products?page=2 must be turned into the full URL.
Fix: Use urljoin(base_url, href).

5) You’re stopping too early

Your loop may break because:

  • “next” link isn’t found
  • duplicate-page detection is too aggressive
  • exceptions are swallowed
  • the scraper thinks it reached the last page

Check: Add debug prints for each loop iteration and break condition.

6) The site requires headers/cookies/session state

Some sites only return paginated content if you preserve:

  • cookies
  • session tokens
  • User-Agent / Referer headers

Fix: Use a persistent session and include the required headers.


Quick debugging checklist

Print these on every iteration:

  • current URL
  • response status code
  • first 200 characters of HTML
  • extracted next-page link/URL
  • whether the loop decides to continue

Example pattern for HTML link pagination

import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin

url = "https://example.com/items"
session = requests.Session()

while url:
    print("Fetching:", url)
    r = session.get(url, headers={"User-Agent": "Mozilla/5.0"})
    print("Status:", r.status_code)

    soup = BeautifulSoup(r.text, "html.parser")
    # process items here...

    next_link = soup.select_one("a.next")
    if next_link and next_link.get("href"):
        url = urljoin(url, next_link["href"])
    else:
        url = None

If you want, paste your scraper code and a sample page URL, and I can point out the exact pagination issue.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.