Skip to content

fix(douyin): search hashtags through the live endpoint and report empty responses - #2254

Open
Benjamin-eecs wants to merge 1 commit into
jackwener:mainfrom
Benjamin-eecs:fix/douyin-empty-response
Open

fix(douyin): search hashtags through the live endpoint and report empty responses#2254
Benjamin-eecs wants to merge 1 commit into
jackwener:mainfrom
Benjamin-eecs:fix/douyin-empty-response

Conversation

@Benjamin-eecs

@Benjamin-eecs Benjamin-eecs commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Description

douyin hashtag search failed for everyone: creator.douyin.com/aweme/v1/challenge/search/ answers HTTP 200 with an empty body, and the command reported Douyin API error -2 ... JSON parse failed, which pointed #2205's reporter at the JSON rather than the endpoint.

The creator studio composer reads hashtag suggestions from /aweme/v1/search/challengesug/ instead; it carries the same cha_name / cid / view_count fields in sug_list and returns a fixed-size list, so the rows are capped by --limit here.

The empty-body branch in browserFetch also comes back (#1408 added it, #1587 lost it to a generic parse-failure wrapper): an empty or whitespace-only 2xx body raises Empty response from Douyin API with a hint naming the usual causes, which also revives the publish flow's fast_detect retry matching on that text; a non-2xx empty body keeps its status, so 401 and 403 stay AuthRequiredError. The old tests mocked page.evaluate wholesale so the generated script never ran; the new ones execute it against a stubbed fetch.

Related issue: Closes #2205

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

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

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (if new adapter)
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

Before, on a logged-in creator session:

$ opencli douyin hashtag search --keyword 美食
error:
  code: COMMAND_EXEC
  message: 'Douyin API error -2 at GET .../challenge/search/...: JSON parse failed: Unexpected end of JSON input'

After, same session:

$ opencli douyin hashtag search --keyword 美食 --limit 5
- name: 美食
  id: '1554036363744257'
  view_count: 1052034193110
- name: 美食教程
  id: '1581688162541582'
  view_count: 422585850860

An endpoint that does answer empty now says so, with the URL and a hint instead of a parse error, and --limit 0 is rejected up front. clis/douyin suite 195 / 195 with twelve new tests, one running the generated script under the bridge envelope; dropping the composer parameters, mapping before the limit slice, or discarding the HTTP status on an empty body each fails a test. Typecheck, both lint gates and doc coverage pass; cli-manifest.json unchanged.

@Benjamin-eecs
Benjamin-eecs force-pushed the fix/douyin-empty-response branch from 8aee18c to 0ca7743 Compare August 5, 2026 08:46
@Benjamin-eecs Benjamin-eecs changed the title fix(douyin): report an empty API response instead of a parse failure fix(douyin): search hashtags through the live endpoint and report empty responses Aug 5, 2026
@Benjamin-eecs
Benjamin-eecs force-pushed the fix/douyin-empty-response branch from 0ca7743 to 2d7931e Compare August 5, 2026 08:59
@Benjamin-eecs
Benjamin-eecs marked this pull request as ready for review August 5, 2026 08:59
Copilot AI lite review requested due to automatic review settings August 5, 2026 08:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Benjamin-eecs
Benjamin-eecs force-pushed the fix/douyin-empty-response branch from 2d7931e to 258be20 Compare August 6, 2026 02:16
@Benjamin-eecs
Benjamin-eecs force-pushed the fix/douyin-empty-response branch from 258be20 to 1f7006c Compare August 8, 2026 12:50
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.

douyin hashtag search 仍然报 JSON parse failed(与 #1405 同根因,已关闭但未真修复)

2 participants