Skip to content

fix(metascraper-tiktok): read rehydration JSON - #885

Merged
Kikobeats merged 1 commit into
masterfrom
fix/tiktok-rehydration
Sep 18, 2026
Merged

Kikobeats merged 1 commit into
masterfrom
fix/tiktok-rehydration

Conversation

@Kikobeats

@Kikobeats Kikobeats commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • TikTok fetch HTML is a PWA shell (TikTok - Make Your Day / TikTok PWA) with no og: tags. The video still lives in __UNIVERSAL_DATA_FOR_REHYDRATION__ → webapp.video-detail.
  • Read author, title, description, image, and publisher from that JSON. Keep og:title as fallback.
  • Replayed production HTML for https://www.tiktok.com/@msnow/video/7685447773642083597.

Test plan

  • pnpm test in packages/metascraper-tiktok
  • Replay production fetch HTML for the msnow video URL
  • After publish, bump metascraper-tiktok on microlink-api

Made with Cursor

Summary by CodeRabbit

  • New Features

    • TikTok video pages now provide video descriptions, preview images, creator names, usernames, and publication dates.
    • Metadata extraction now supports TikTok video pages that do not include Open Graph metadata.
  • Bug Fixes

    • Improved consistency when retrieving TikTok creator and video details across supported page formats.
  • Tests

    • Added coverage for TikTok video-page metadata extraction and updated expected image metadata.

TikTok fetch HTML is a PWA shell with no og tags. Video author,
caption, and cover are in __UNIVERSAL_DATA_FOR_REHYDRATION__.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bf9de749-14f1-4b90-9a64-4310c7c8faa3

📥 Commits

Reviewing files that changed from the base of the PR and between 3914e46 and 24ad679.

⛔ Files ignored due to path filters (1)
  • packages/metascraper-tiktok/test/snapshots/index.js.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • packages/metascraper-tiktok/src/index.js
  • packages/metascraper-tiktok/test/fixtures/video-pwa.html
  • packages/metascraper-tiktok/test/index.js
  • packages/metascraper-tiktok/test/snapshots/index.js.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The TikTok scraper now reads video and user metadata from the __UNIVERSAL_DATA_FOR_REHYDRATION__ payload. It adds description, image, publisher, author, username, and date extraction coverage for video pages without Open Graph metadata.

Changes

TikTok video metadata

Layer / File(s) Summary
Rehydration data extraction
packages/metascraper-tiktok/src/index.js
Shared helpers parse video-detail and user-detail data. Rules extract author, username, description, image, date, and publisher values.
Video fixture and snapshot validation
packages/metascraper-tiktok/test/fixtures/video-pwa.html, packages/metascraper-tiktok/test/index.js, packages/metascraper-tiktok/test/snapshots/index.js.md
A video-page fixture and snapshot test cover extraction without Open Graph metadata. The profile image snapshot uses updated image URL data.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant TikTokPage
  participant RehydrationHelpers
  participant MetascraperRules
  TikTokPage->>RehydrationHelpers: Read __UNIVERSAL_DATA_FOR_REHYDRATION__
  RehydrationHelpers->>MetascraperRules: Return video and user details
  MetascraperRules->>MetascraperRules: Build TikTok metadata
Loading

Merge Risk: ⚪ Minimal · up to 24ad6

No actionable issue remains; the metadata extraction update is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: updating metascraper-tiktok to read rehydration JSON for TikTok metadata.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

Coverage is 97.37% — fix/tiktok-rehydration into master. No base build found for master.

@Kikobeats
Kikobeats merged commit 1ce9525 into master Sep 18, 2026
54 checks passed
@Kikobeats
Kikobeats deleted the fix/tiktok-rehydration branch September 18, 2026 18:34
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