Repository navigation
Fix PNG original photo URLs - #2
Open
O0000-code wants to merge 3 commits into
Open
O0000-code wants to merge 3 commits into
O0000-code wants to merge 3 commits into
Conversation
added 2 commits
August 15, 2026 21:55
X moved the author display fields out of `legacy` on `user_results.result` into sibling objects: `core` holds `name` and `screen_name`, `avatar` holds `image_url`, `verification` holds `verified`. `legacy` is still there and still carries `followers_count`. `extractAuthor` only read `legacy`, so exports came back with a numeric `user_id` and null name, handle and profile image. Nothing surfaces it: the export completes, every bookmark is well-formed, and permalinks still work because `x.com/i/status/<id>` redirects. Both locations are read, the current one first, so responses predating the move still parse. Quoted-tweet authors use the same fields and are fixed alongside.
pbs.twimg.com rejects a path extension that disagrees with `format`, so a PNG asked for as `<id>.png?format=jpg&name=orig` returns 404. JPEGs happened to work because the path extension matched the hardcoded `format=jpg`. Measured on an export of 833 bookmarks: 50 images across 45 tweets, every one of them a PNG. The download is attempted per file, so the failure surfaces as a handful of unrelated-looking 404s rather than as anything about PNGs. Dropping the extension and taking `format` from it fetches all of them.
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
format=jpgThe author-field half of this PR is no longer part of the proposed diff. Upstream
mainfixed the current author name, handle, avatar, and quoted-author paths inae9d026; this branch is merged with that commit before applying the remaining media-only change.Problem and reproduction
media_url_httpsends in.png.mainemits<id>.png?format=jpg&name=orig.pbs.twimg.comrejects the mismatch between the path extension andformat, returning 404.extractMedia()currently appends?format=jpg&name=origto every photo URL. The fix removes the extension from the request path and uses it as theformatparameter, producing<id>?format=png&name=orig. JPEGs continue to produceformat=jpg.The bug was found while exporting a real bookmark archive: PNG-hosted photos failed to download until the extension was carried into the
formatparameter.Validation
Run against upstream
mainatae9d026with Node v25.4.0 (README asks for Node 24):node --test tests/*.test.mjsonae9d026, before this change: 65 pass / 0 fail.ae9d026, before this change: fails, with the actual URLhttps://pbs.twimg.com/media/image.png?format=jpg&name=orig.node --test tests/*.test.mjsafter this change: 66 pass / 0 fail.maincontains onlylib/parser.jsandtests/parser-media.test.mjs; no author-field change remains.