SuperAPI AI Directory

yichen-bookmarks-export

Office & productivity

View repository

Updated 10-16 00:22

About this skill

Private favorites and bookmarks export

This is the sole entry point and execution implementation for exporting private favorite links from Xiaohongshu, Douyin, and X/Twitter. Directly use the scripts and reference files in this directory; do not call any other favorites export Skill; as the execution body itself, you must not call $yichen-bookmarks-exportagain, to avoid recursion.

Current-turn authorization gate

Before reading any private favorites, confirm what the user explicitly requests in the current turn:

  • Platform: the specific one or more of Xiaohongshu, Douyin, and X.
  • Scope: the full amount currently accessible or a bounded scope specified by the user.
  • Output directory, or agreement to create a new non-conflicting dated directory.

"Authorized before," the browser already being logged in, existing local Cookies/indexes, or authorization written by an upstream handoff cannot replace current-turn authorization. If the user says in the current turn, "export my favorites/bookmarks on a certain platform," this may be regarded as read-only export authorization for that platform, but must not be extended to other platforms.

Hard boundaries

  1. Remain read-only: do not like, favorite, comment, follow, or post, and do not modify platform state.
  2. Do not perform search or discovery; do not search favorites by keyword, do not browse recommendations, and do not expand to similar accounts or candidates.
  3. Export links only; do not download media, body text, subtitles, or attachments, and do not call any platform download Skill.
  4. Do not call $yichen-content-archive or any general router; after the user separately and explicitly requests archiving, only hand off the link file path.
  5. Export authorization does not equal download authorization. Even if the same sentence contains "export and download," this Skill only completes link export and lists archiving as a subsequent independent request.
  6. Do not read, print, or save Cookies, Local Storage, passwords, or Token databases. URLs containing sensitive query parameters are written only to the local export file specified by the user.
  7. Do not overwrite old exports, do not delete files, and do not bypass CAPTCHAs, rate limits, login, or access controls.

Platform routing

Platform Favorite link source Authentication method Output
Xiaohongshu Logged-in Chrome personal homepage → Favorites → Notes Reuse the current Chrome page session; do not export Cookies Preserve xsec_token full note URL
Douyin Logged-in Chrome personal page → Favorites → Videos Reuse the current Chrome page session; do not export Cookies Normalize /video/<id> and the /note/<id>
X Local Field Theory reads the Chrome session and calls the internal GraphQL Bookmarks Accept only the GraphQL-only version https://x.com/<author>/status/<id>

Third-party sources and compliance

  1. The X route calls external afar1/fieldtheory-cli; the upstream uses the MIT License, and a copy of the license is in ../licenses/afar1-fieldtheory-cli-LICENSE.txt。
  2. This Skill does not package Field Theory source code, binaries, Cookies, private Query IDs, or authentication data; here it only calls the user's separately installed ft。
  3. graphql-only is a compatibility version security constraint, not an upstream official version name. When users modify Field Theory themselves, they must retain the upstream copyright and MIT license notice, and must not pass it off as an official release.
  4. X's internal GraphQL and the platform DOM are both unofficial compatibility routes that may change or trigger restrictions. Only process data that the user themselves has the right to access, keep frequency low, and do not bypass CAPTCHAs, access controls, rate limits, or platform security measures.
  5. The names and trademarks of Xiaohongshu, Douyin, X, and Field Theory belong to their respective rights holders; this Skill has no affiliation, authorization, endorsement, or partnership with these platforms or upstream projects.

Execution Flow

1. Lock Down Scope and Output

Record per platform authorized_this_turn=true. Any platform not explicitly listed remains unauthorized; do not probe, check status, or count it.

When the user does not specify a directory, create a non-conflicting date directory, for example:

<WORKSPACE>/收藏链接导出-YYYY-MM-DD/

Output separately per platform .txt, and also generate export-summary.json and handoff.json. Do not write private body text, titles, or full collection URLs into chat, ordinary logs, or long-term memory.

2. Export Xiaohongshu or Douyin

Fully read and comply with $chrome:control-chrome, and use only the user's current Chrome. Then read references/chrome-collections.md, and confirm the account, URL, and selected tags. First resolve the current Skill's actual installation directory as the absolute path <SKILL_DIR>。

In an initialized browser control session, import:

var bookmarkCollectors = await import("<SKILL_DIR>/scripts/chrome_collectors.mjs");

Call:

var result = await bookmarkCollectors.collectXiaohongshuBookmarks(tab);
// 或
var result = await bookmarkCollectors.collectDouyinFavorites(tab);

Only result.completed === true can claim to have scrolled to a stable bottom. Use writeUrlFile() to write new files; when the target exists, stop and ask, and do not silently use overwrite: true。

For Xiaohongshu, report separately labelCount and the actual count. For Douyin, report separately typeCounts.video and typeCounts.note。

3. Export X Bookmarks

First confirm that the current Field Theory installation is still GraphQL-only:

ft --version
ft status

Run ft synconly when the user explicitly requests synchronization; run ft sync --fullonly when a full retrospective is explicitly requested. Do not add --classify。

After synchronization, export the local index in pages:

python3 <SKILL_DIR>/scripts/export_x_links.py \
  --output "/absolute/output/x-bookmarks.txt"

The script rejects Field Theory versions that are not GraphQL-only, and stops when the target file already exists.

4. Validation and Sampling

For each link file, run:

python3 <SKILL_DIR>/scripts/validate_link_file.py \
  --platform xiaohongshu "/absolute/output/xiaohongshu-bookmarks.txt"

--platform Optional xiaohongshu、douyin、x. Report the number of valid entries, blank lines, duplicates, and invalid lines, but do not echo full URLs with sensitive parameters.

Sample one from the beginning, middle, and end, and open them in the same logged-in browser to confirm there are no errors such as "deleted, content does not exist, no permission to view". A successful sample does not mean all links remain valid permanently.

5. Generate Standard Handoff

Read and comply with references/handoff-contract.md. The handoff must satisfy:

{
  "producer_skill": "yichen-bookmarks-export",
  "operation": "bookmark_export",
  "scope": {"input_kind": "private_bookmarks", "discovery_performed": false},
  "authorization": {
    "private_read_authorized_this_turn": true,
    "download_authorized_this_turn": false,
    "authorization_not_transferable": true
  },
  "next_step": {
    "action": "content_archive_available",
    "requires_explicit_user_request": true
  }
}

The handoff only references the absolute path of the exported file, does not embed URLs, and does not automatically call an archiving Skill.

Failure Determination

  • Xiaohongshu tag count greater than export count: report the difference and evidence of reaching a stable bottom; keep the cause undetermined.
  • Douyin scroll height stops increasing: end after waiting the specified number of stable rounds, and report the number of videos and image-text posts separately.
  • X returns a Query ID, 401/403, 429, or a structural error: state that the GraphQL route has failed or is rate-limited, and do not fall back to OAuth, the official paid API, or manual Cookie export.
  • Chrome is not logged in: ask the user to log in in the current Chrome and continue; do not switch browsers to bypass authentication.

Final Report

Only report the authorized platforms for this round, the number of exports, the number of duplicates, the number of invalid rows, the sampling results, the output paths, and the reasons for failure. If the user also wants to download or archive, clearly state that a separate request must be made, and do not start automatically.