Skip to content

domain-skills: add Discord channel scraping - #545

Open
alexandme wants to merge 1 commit into
browser-use:mainfrom
alexandme:domain-skill/discord-scraping
Open

domain-skills: add Discord channel scraping#545
alexandme wants to merge 1 commit into
browser-use:mainfrom
alexandme:domain-skill/discord-scraping

Conversation

@alexandme

@alexandme alexandme commented Jul 21, 2026

Copy link
Copy Markdown

What

Adds domain-skills/discord/scraping.md — reading full message history from a Discord channel via the logged-in web app.

Field-tested learnings captured

  • Message list is fully virtualized; scroll-up + merge loop keyed on li[id^="chat-messages-"] ids (snowflakes → chronological sort across batches).
  • Trap: reply messages contain a quoted-parent preview whose div also matches div[id^="message-content-"] — a bare querySelector silently scrapes the quoted text instead of the reply body. Fix: filter out nodes inside div[class*="repliedMessage"].
  • Grouped (same-author) messages render without the h3 author header — forward-fill after sorting.
  • h3 innerText concatenates username + server tag + timestamp tooltip; use span[class*="username"] only.
  • Start-of-channel detection, time[datetime] absolute timestamps, embeds via article, reactions via img alt, pinned-messages popout.

All selectors are attribute/class-prefix based (Discord's class names are hashed but prefixes are stable); no pixel coordinates, no user-specific state.


Summary by cubic

Add a new guide for scraping full Discord channel history through the logged-in web app, no API token required. It explains scroll-and-merge extraction with stable selectors and covers common traps and pins.

  • New Features
    • Added domain-skills/discord/scraping.md.
    • URL pattern and DOM selectors for messages (ol[data-list-id], li[id^="chat-messages-"]) and scroller.
    • Scroll-up + merge loop using snowflake ids for chronological merges; start-of-channel detection.
    • Timestamps via time[datetime], embeds via article, reactions from img[alt].
    • Traps: reply-preview content id conflict, grouped messages without author header, noisy h3, edited-text suffix.
    • Pinned messages: open pins popout and read messagesPopout content.

Written for commit e476899. Summary will update on new commits.

Review in cubic

@browser-harness-review

Copy link
Copy Markdown

✅ Skill review passed

Reviewed 1 file(s) — no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="domain-skills/discord/scraping.md">

<violation number="1" location="domain-skills/discord/scraping.md:40">
P2: The documented extraction shape can emit every reply without its parent relationship because `replyTo` has no selector or extraction step, while the only reply-specific node is discarded for text extraction. Capturing the parent id from the `repliedMessage` preview before excluding it would make the advertised field usable.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic


## Extraction loop shape

Per pass: collect `{id, author, time, text, replyTo, links, embeds, reactions}` for every `li`, merge into a dict keyed by id, scroll top, sleep ~1.5s, repeat until start marker + zero new ids. A ~25-message channel takes 2–3 passes at a full-height viewport.

@cubic-dev-ai cubic-dev-ai Bot Jul 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The documented extraction shape can emit every reply without its parent relationship because replyTo has no selector or extraction step, while the only reply-specific node is discarded for text extraction. Capturing the parent id from the repliedMessage preview before excluding it would make the advertised field usable.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At domain-skills/discord/scraping.md, line 40:

<comment>The documented extraction shape can emit every reply without its parent relationship because `replyTo` has no selector or extraction step, while the only reply-specific node is discarded for text extraction. Capturing the parent id from the `repliedMessage` preview before excluding it would make the advertised field usable.</comment>

<file context>
@@ -0,0 +1,44 @@
+
+## Extraction loop shape
+
+Per pass: collect `{id, author, time, text, replyTo, links, embeds, reactions}` for every `li`, merge into a dict keyed by id, scroll top, sleep ~1.5s, repeat until start marker + zero new ids. A ~25-message channel takes 2–3 passes at a full-height viewport.
+
+## Pinned messages
</file context>
Fix with cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant