Skip to content

fix(twitter): use DOM-only scraping for trending to match page results#486

Merged
jackwener merged 1 commit intojackwener:mainfrom
Astro-Han:worktree-fix-twitter-trending
Mar 27, 2026
Merged

fix(twitter): use DOM-only scraping for trending to match page results#486
jackwener merged 1 commit intojackwener:mainfrom
Astro-Han:worktree-fix-twitter-trending

Conversation

@Astro-Han
Copy link
Copy Markdown
Contributor

Description

Remove the guide.json API path from twitter trending command. The API returned data inconsistent with what users see on the trending page, causing #463.

Now uses DOM-only scraping with semantic caret button detection (data-testid="caret") instead of position-based heuristics, and validates post count text contains digits before displaying.

Related issue: #463

Type of Change

  • 🐛 Bug fix

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Screenshots / Output

  twitter/trending
┌──────┬───────────────────────────────────┬────────┬─────────────┐
│ Rank │ Topic                             │ Tweets │ Category    │
├──────┼───────────────────────────────────┼────────┼─────────────┤
│ 1    │ ストーカー                        │ N/A    │ 日本 的趋势 │
├──────┼───────────────────────────────────┼────────┼─────────────┤
│ 2    │ トライネン                        │ N/A    │ 日本 的趋势 │
├──────┼───────────────────────────────────┼────────┼─────────────┤
│ 3    │ #倍ビッグマックはデッッカすぎ     │ N/A    │ 美食 趋势   │
└──────┴───────────────────────────────────┴────────┴─────────────┘

Remove guide.json API path that returned data inconsistent with what
users see on the page (jackwener#463). Use semantic caret button detection
via data-testid instead of position-based heuristics, and validate
post count text contains digits before displaying.
@jackwener jackwener merged commit fb5b608 into jackwener:main Mar 27, 2026
23 checks passed
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.

2 participants