Skip to content

Add Douyin comment export UI#1

Open
amazinglvxw wants to merge 1 commit intomainfrom
codex/develop-interface-for-dataminer-api
Open

Add Douyin comment export UI#1
amazinglvxw wants to merge 1 commit intomainfrom
codex/develop-interface-for-dataminer-api

Conversation

@amazinglvxw
Copy link
Copy Markdown
Owner

Motivation

  • Provide a simple frontend so users can call the DataMiner API to extract Douyin (抖音) video comments by entering only an API key, API endpoint, and video link, and then export results to CSV.
  • Support common extraction options such as result limit, ordering (e.g. high likes first), minLikes, keyword filtering and free-form requirements to satisfy typical scraping/filtering needs.

Description

  • Add index.html to present a responsive form for API Key, API Endpoint, Douyin video URL and extraction options plus a status panel and download action.
  • Add styles.css to style the UI with a responsive layout, form controls and status visuals.
  • Add app.js with client-side logic to POST the request to the configured endpoint with the provided API key, normalize the returned comment payload, apply minLikes and keyword filters, sort by the selected order, generate a CSV and trigger a download.
  • Provide safe CSV escaping, a normalizeComments helper to handle different API response shapes, and UI status updates for working/success/error states.

Testing

  • Launched a static HTTP server via python -m http.server 8000 and served the new files, which started successfully.
  • Ran an automated Playwright script to load http://127.0.0.1:8000/index.html and capture a screenshot of the rendered UI, which completed successfully and produced an artifact.
  • No unit or backend integration tests were executed for the API call path in this change.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a59145aa3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app.js
Comment on lines +154 to +157
} else if (order === "time_desc") {
comments.sort((a, b) => String(b.createdAt).localeCompare(String(a.createdAt)));
} else if (order === "time_asc") {
comments.sort((a, b) => String(a.createdAt).localeCompare(String(b.createdAt)));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Sort timestamps numerically for time-based order

The time-based sort uses String(...).localeCompare(...), which performs lexicographic ordering. If createdAt is a Unix timestamp or any non–zero-padded date string (common in APIs), lexicographic order mis-sorts values (e.g., "9" > "10"). This causes time_desc/time_asc to return incorrect results for those inputs; parsing to numbers or Date objects before comparing would avoid the misordering.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant