Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-4-20250514-thinking-32k· AnthropicHugging Face LMArena Human Preference 140K

A website exhibits the following behaviors to prevent user from extracting its texts (in…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Googlegemma-3n-e4b-it’s answer.
  1. User

    A website exhibits the following behaviors to prevent user from extracting its texts (in Chinese characters): 1. the correct text is only displayed when it is within the viewing area, i.e. extracting directly from DOM will output unrelated texts, 2. even if a paragraph is correctly shown, the elements in DOM is not aligned/ordered like the viewable text, they have to be repositioned to give the correct result, 3. even if a particular element is identified to represent a viewable character, that element is not that character (font mapping is deliberately altered). How can such a website achieves each of these, and how to reverse engineer them in order to reliably extract the correct texts?

  2. Claude Assistant

    These are sophisticated anti-scraping techniques. Here's how each works and potential approaches to reverse engineer them:

    1. Viewport-Based Text Display

    How it works:

    • JavaScript monitors scroll position and viewport intersection
    • Real content is dynamically loaded/replaced only when elements enter the visible area
    • Out-of-viewport elements contain dummy text or are empty
    • Uses Intersection Observer API or scroll event listeners

    Reverse engineering approaches:

    • Simulate scrolling through the entire page programmatically
    • Use headless browsers (Puppeteer, Selenium) to trigger viewport events
    • Monitor network requests during scrolling to identify content loading patterns
    • Inject JavaScript to force-trigger intersection observers for all elements

    2. DOM Element Scrambling

    How it works:

    • CSS positioning (absolute/relative) places elements visually different from DOM order
    • Text might be split across multiple <span> elements with z-index layering
    • CSS transforms (translate, rotate) reposition character elements
    • Characters stored in reverse order or random sequence in DOM

    Reverse engineering approaches:

    • Extract computed CSS styles for each text element
    • Calculate actual visual positions using getBoundingClientRect()
    • Sort elements by their visual coordinates (top-to-bottom, left-to-right)
    • Account for CSS transforms and positioning in coordinate calculations
    • Use OCR as a fallback to capture the visually rendered text

    3. Font Substitution/Custom Font Mapping

    How it works:

    • Custom web fonts with remapped Unicode codepoints
    • Character 'A' in DOM might render as '中' due to font mapping
    • CSS @font-face rules load fonts with altered character mappings
    • Font files contain different glyphs than expected for each Unicode point

    Reverse engineering approaches:

    • Download and analyze the custom font files (.woff, .ttf, etc.)
    • Use font analysis tools to extract the actual character mappings
    • Create a reverse mapping table (displayed character → actual Unicode)
    • Take screenshots and use OCR to capture the visually rendered text
    • Monitor font loading and extract font data from browser cache

    Combined Approach for Reliable Extraction

    For websites using all three techniques, you'd need a multi-step process:

    1. Full page rendering: Use headless browser to scroll through entire content
    2. Visual coordinate mapping: Extract element positions and sort by visual layout
    3. Font analysis: Decode custom font mappings to translate characters
    4. OCR verification: Use optical character recognition as ground truth validation

    The most robust approach often combines programmatic extraction with OCR of the rendered page, cross-referencing results to ensure accuracy. Modern headless browsers with screenshot capabilities make this increasingly feasible for complex protection schemes.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.