fix: resolve author from new X user schema (core) in export scripts#84
Open
JinZhongcun wants to merge 1 commit into
Open
fix: resolve author from new X user schema (core) in export scripts#84JinZhongcun wants to merge 1 commit into
JinZhongcun wants to merge 1 commit into
Conversation
X moved user fields (name, screen_name) from user_results.result.legacy to user_results.result.core, so both the bookmarklet and the console export script now return author: "Unknown" and handle: "@unknown" for every captured tweet. Read .legacy first and fall back to .core, and resolve the avatar from user_results.result.avatar.image_url when profile_image_url_https is absent. Verified against a live export of ~8,000 bookmarks: authors resolve correctly on the current schema, and exports from the old schema keep working.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
X moved user fields (
name,screen_name) fromuser_results.result.legacytouser_results.result.core. Both the bookmarklet and the console export script only read.legacy, so on the current schema every exported tweet comes back withauthor: "Unknown"/handle: "@unknown".Changes
.legacyfirst and fall back to.core(bothBOOKMARKLET_SCRIPTandCONSOLE_SCRIPTinapp/import/page.tsx)user_results.result.avatar.image_urlwhenprofile_image_url_httpsis absentRelated Issues
None
Checklist
npx tsc --noEmit— no new errors introduced by this change (the 2 pre-existing errors inapp/api/import/x-oauth/fetch/route.tsare present onmainas well)