CI / Typecheck, test, build (pull_request) Successful in 9s
Two changes. They share the `Segment` model, which is why they arrive
together.
## Reddit
A new adapter under /reddit, plus the thread beneath the post -- on Reddit the
conversation is usually the reason the link was shared, so a viewer that showed
only the post would be showing the wrong half.
The `.json` twin of a post URL is the post and the whole first page of comments
in one response, far better than anything the page gives up, so it is the only
layer that normally runs. Reddit refuses it to a browser it has never seen and
answers with a JavaScript challenge, which any ordinary navigation solves by
itself; the adapter navigates once and retries, and the cookie left behind
serves every later post. Below that, `shreddit-comment` elements are read from
the rendered page -- flat, each carrying its own `depth`, so `treeFromDepths`
rebuilds the nesting.
`Post.comments` is a tree rather than a flat list with depths, because folding
a comment has to take everything under it along and nesting is what makes that
free. Each comment renders as a `<details open>`, so collapsing works with the
stylesheet off and from the keyboard, and a collapsed one says how many replies
it is hiding. "Collapse all" is the only part that needs the script, so it
ships hidden and appears once the script has run. What sits behind a "load
more" is not fetched -- that is a second page and often a third -- but it is
counted and said out loud rather than quietly dropped.
Four things the payloads got wrong on the first try, each now with a fixture:
`fallback_url` is the video track alone whenever `has_audio` is true, so a post
with sound has to use `hls_url` and only a silent one gets the proxied MP4;
`scrubber_media_url` looks like a poster and is a second MP4 for the timeline
thumbnails, while the still is in `preview.images`; a gallery's pictures live
in `media_metadata` keyed and unordered, with their order only in
`gallery_data`; and `replies` is the string "" rather than an object when there
are none. Comment bodies are Markdown, rendered by a new render/markdown.ts
that escapes first and then puts back only the constructs we chose to support
-- never Reddit's own `body_html`, which would mean trusting markup a stranger
caused to be generated.
An app share link (/r/<sub>/s/<code>) is a plain 301, so one request told not
to follow it is enough. The permalink it resolves to is what the copy button
hands back, since an opaque share code is a tracking parameter by another name.
## Quoted posts
Both X and Bluesky lifted the quoted post's media out and showed it as the
quoter's own, dropping the quoted words and the quoted author entirely. A quote
of a photo post therefore rendered as somebody else's picture under the wrong
name with nothing to say so, and a quote that had a picture of its own dropped
the quoted one instead -- the two could never both appear. Half the quote posts
people share are someone answering a stranger and the other half are someone
continuing a thought from an earlier post; neither reads with only one side of
it on the page.
`Segment.quoted` now carries the whole thing -- author, words, pictures, time
and a link to it -- and renders as a post inside the post. Neither payload
carries a usable address for it: X has no permalink and it is rebuilt from the
handle and `id_str`, Bluesky has an `at://` URI nobody can open and it is
rebuilt from the handle and the record key. On Bluesky the record sits at
`embed.record` for a plain quote and at `embed.record.record` when the quoting
post has media of its own, and a quote can also point at a feed, a list or a
post since deleted, which arrive in the same slot under a different `$type` --
only `app.bsky.embed.record#viewRecord` is taken.
Two things about X's text, both visible on any post and not only a quote. It
arrives pre-escaped, so an ampersand someone typed was reaching the page as the
literal `&`; it is decoded in the adapter, where the encoding comes from,
leaving the escape-on-the-way-out rule alone. And every link is a `t.co`, which
tells the reader nothing and routes them through X's click tracker to find out
-- `entities.urls` carries the real address alongside, so it is put back. The
shortlink X staples onto the end of a quote post is dropped rather than
expanded, since the post it points at is already on the page;
`display_text_range` is where that boundary is and it keeps a link the author
put there deliberately. Its indices are UTF-16 units into the escaped text, so
the slice happens before decoding and before expanding, and splitting to
codepoints first overshoots past an emoji -- checked against a post carrying
one.
A quote is context, and context that fills the screen has stopped being
context, so a segment carrying one gives up the window-filling cap on its own
media.
## Along the way
setupMedia only ever wired `document.querySelector('.media')`, the first rail
on the page. That was already wrong for a Bluesky or Threads chain with media
in more than one post, and a quoted carousel would have hit it too. It now runs
per rail.
## Verified
108 tests, typecheck and build clean. Resolved end to end against the live
platforms: Reddit self, gallery, video, link and share-link posts; X quotes
with no media, with media on the quoted side, and with media on both; Bluesky
quotes in both embed shapes, including a ten-post chain where every post quotes
a different account and all nine quotes come back under the right name.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017nMQ2eDKnqALYhAibpTKTu
452 lines
16 KiB
JSON
452 lines
16 KiB
JSON
[
|
||
{
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t3",
|
||
"data": {
|
||
"title": "1957 Ford Fairlane",
|
||
"author": "icleanjaxfl",
|
||
"subreddit_name_prefixed": "r/oddlysatisfying",
|
||
"created_utc": 1787830536,
|
||
"selftext": "",
|
||
"permalink": "/r/oddlysatisfying/comments/1vzrfkw/1957_ford_fairlane/",
|
||
"url": "https://v.redd.it/74hudhx2mwlh1",
|
||
"url_overridden_by_dest": "https://v.redd.it/74hudhx2mwlh1",
|
||
"domain": "v.redd.it",
|
||
"post_hint": "hosted:video",
|
||
"is_self": false,
|
||
"is_video": true,
|
||
"over_18": false,
|
||
"spoiler": false,
|
||
"num_comments": 109,
|
||
"score": 3477,
|
||
"secure_media": {
|
||
"reddit_video": {
|
||
"bitrate_kbps": 2400,
|
||
"fallback_url": "https://v.redd.it/74hudhx2mwlh1/CMAF_720.mp4?source=fallback",
|
||
"has_audio": false,
|
||
"height": 1280,
|
||
"width": 720,
|
||
"scrubber_media_url": "https://v.redd.it/74hudhx2mwlh1/CMAF_96.mp4",
|
||
"dash_url": "https://v.redd.it/74hudhx2mwlh1/DASHPlaylist.mpd?a=1790429193%2CNjQwMTBmMDMxODhjMGViOGUyMjU2ZDE2NGFkNmI2MDU2ZDQ2NmVjNmEzNzg0MTQzNGVkMTU5OGI2ZTgyYTU3ZQ%3D%3D&v=1&f=sd",
|
||
"duration": 25,
|
||
"hls_url": "https://v.redd.it/74hudhx2mwlh1/HLSPlaylist.m3u8?a=1790429193%2CZjkwZmQwODJiYmRhNGY2NDkyYTMxMDZlYmVhMzQwYWVkYTg0MzMwOWEwYjAyMGZhMzY0MWJmYTIyMmE0OTQ3Zg%3D%3D&v=1&f=sd",
|
||
"is_gif": false,
|
||
"transcoding_status": "completed"
|
||
}
|
||
},
|
||
"media": {
|
||
"reddit_video": {
|
||
"bitrate_kbps": 2400,
|
||
"fallback_url": "https://v.redd.it/74hudhx2mwlh1/CMAF_720.mp4?source=fallback",
|
||
"has_audio": false,
|
||
"height": 1280,
|
||
"width": 720,
|
||
"scrubber_media_url": "https://v.redd.it/74hudhx2mwlh1/CMAF_96.mp4",
|
||
"dash_url": "https://v.redd.it/74hudhx2mwlh1/DASHPlaylist.mpd?a=1790429193%2CNjQwMTBmMDMxODhjMGViOGUyMjU2ZDE2NGFkNmI2MDU2ZDQ2NmVjNmEzNzg0MTQzNGVkMTU5OGI2ZTgyYTU3ZQ%3D%3D&v=1&f=sd",
|
||
"duration": 25,
|
||
"hls_url": "https://v.redd.it/74hudhx2mwlh1/HLSPlaylist.m3u8?a=1790429193%2CZjkwZmQwODJiYmRhNGY2NDkyYTMxMDZlYmVhMzQwYWVkYTg0MzMwOWEwYjAyMGZhMzY0MWJmYTIyMmE0OTQ3Zg%3D%3D&v=1&f=sd",
|
||
"is_gif": false,
|
||
"transcoding_status": "completed"
|
||
}
|
||
},
|
||
"preview": {
|
||
"images": [
|
||
{
|
||
"source": {
|
||
"url": "https://external-preview.redd.it/N245aGFidjJtd2xoMRGGAvg1khFB1AQL8vVunwC_Mb5qnXHCQGxm0j4C5bdR.png?format=pjpg&auto=webp&s=cd60e451633a907b172389c0cd1c09e174ac9f16",
|
||
"width": 405,
|
||
"height": 720
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Head-State-",
|
||
"body": "That retractable hardtop transformer mechanism is pure engineering wizardry.",
|
||
"created_utc": 1787830965,
|
||
"score": 328,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Pretend-Internet-625",
|
||
"body": "ya until you have to go and fix it and make it work properly. ",
|
||
"created_utc": 1787832356,
|
||
"score": 150,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "bigalindahouse",
|
||
"body": "Would much rather work on this than today's vehicles",
|
||
"created_utc": 1787833724,
|
||
"score": 63,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Pretend-Internet-625",
|
||
"body": "Well ya I get that but these were a real pain in the ",
|
||
"created_utc": 1787833961,
|
||
"score": 6,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Brasticus",
|
||
"body": "r/redditsniper claims another",
|
||
"created_utc": 1787834765,
|
||
"score": 21,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": ""
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Andy_B_Goode",
|
||
"body": "Yeah, it's neat, but it also totally looks like one of those things that would break in the first two or three years and most people wouldn't bother fixing",
|
||
"created_utc": 1787835341,
|
||
"score": 6,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "utukore",
|
||
"body": "Same setup was used for the e93 roof. Other than the squeeks and rattles or the slow open/ close time they worked well.",
|
||
"created_utc": 1787836411,
|
||
"score": 3,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": ""
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "kss1089",
|
||
"body": "Everything is a 4 bar mechanism. if it's super complicated, it's multiple 4 bar mechanisms. ",
|
||
"created_utc": 1787833936,
|
||
"score": 12,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": ""
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Tony_Penny",
|
||
"body": "Ford Fairlane, rock and roll detective. ",
|
||
"created_utc": 1787831095,
|
||
"score": 29,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "perflubon",
|
||
"body": "One of the best \"worst\" movies ever.",
|
||
"created_utc": 1787832767,
|
||
"score": 7,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Tony_Penny",
|
||
"body": "I absolutely loved that movie as a kid. ",
|
||
"created_utc": 1787833553,
|
||
"score": 3,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": ""
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "imamakebaddecisions",
|
||
"body": "Booty time, booty time, across the USA, booty time, booty time, hey hey hey!",
|
||
"created_utc": 1787833566,
|
||
"score": 5,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": ""
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "[deleted]",
|
||
"body": "[removed]",
|
||
"created_utc": 1787833134,
|
||
"score": 145,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Bongressman",
|
||
"body": "And covering it for the winter... then uncovering it in the Spring. Getting that \"unwrapping a new gift\" endorphin rush all over again every year.",
|
||
"created_utc": 1787834518,
|
||
"score": 8,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "zytukin",
|
||
"body": "You'd leave it outside over winter???",
|
||
"created_utc": 1787834574,
|
||
"score": 4,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Bongressman",
|
||
"body": "I live in Seattle, so snow isnt a factor. Streets are dotted with covered cars in the winter. I guess it depends on location!",
|
||
"created_utc": 1787834801,
|
||
"score": 1,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Flyingdutchman2305",
|
||
"body": "?? Isnt there lots of snow in seattle",
|
||
"created_utc": 1787835019,
|
||
"score": 1,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Bongressman",
|
||
"body": "No. It doesn't snow in Seattle. We don't even have a snow removal budget in the city.\n\nWinter bottoms out at like 40-45 fahrenheit. It just mists, drizzles, gets overcast and grey for six months.",
|
||
"created_utc": 1787835128,
|
||
"score": 2,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Flyingdutchman2305",
|
||
"body": "Huh, my american Geography when it comes to latitude is apparently off\n\n",
|
||
"created_utc": 1787835286,
|
||
"score": 1,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Bongressman",
|
||
"body": "It snows in Washington state, just not Seattle. We are surrounded by the Cascades and Olympic Mountains. Kind of boxed in and protected.\n\nOur weather closely mirrors London's, but with even less snowfall.",
|
||
"created_utc": 1787835622,
|
||
"score": 1,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": {
|
||
"kind": "Listing",
|
||
"data": {
|
||
"children": [
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "Flyingdutchman2305",
|
||
"body": "Never knew, always thought it was one of those typical snowy winter cities",
|
||
"created_utc": 1787835875,
|
||
"score": 1,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": ""
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "zytukin",
|
||
"body": "It's not due to latitude, Seattle is more north than Wyoming, Kansas, etc which get a lot of snow.\n\nI think it has to do with being near the west coast so it gets hit with warm air coming up from the tropics.",
|
||
"created_utc": 1787835832,
|
||
"score": 1,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": ""
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"kind": "t1",
|
||
"data": {
|
||
"author": "its_Raze_7",
|
||
"body": "bot",
|
||
"created_utc": 1787836203,
|
||
"score": 2,
|
||
"score_hidden": false,
|
||
"is_submitter": false,
|
||
"replies": ""
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"kind": "more",
|
||
"data": {
|
||
"count": 1,
|
||
"id": "p676rzl"
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
]
|