Repository navigation
Read Reddit and Hacker News threads with site handlers - #123
Merged
Merged
Conversation
A Hacker News thread came out as hundreds of nested layout tables with a spacer picture per comment, and a Kindle book made from it arrived in fixed layout. Pages that need code of their own now go through a small site interface: Reddit uses it, and a Hacker News item page becomes an article with the story's points, author, date and link, then the comments in the order the page ranks them, replies nested in quotes at most eight deep. Polls, a comment's or a poll option's own page, and flagged or deleted comments are handled. How a page is fetched (address, retriever, Cloudflare fallback) is now decided once, in plan. A rule with a selector still reads a site's page itself, and the site's code takes over when the selector finds nothing. The response carries parser, naming what read the article, and a site handler that cannot read a page logs a warning. Rule suggestions are refused for hosts a handler owns. Each site's test page has its expected article in a golden file.
The guide for coding agents is now AGENTS.md. It gains a table of where a site-specific fix belongs: a rule, a rule flag, a site handler, a readeck preparation pass, or ukeeper-worker.
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.
Previously, a Hacker News thread came out as the page's own layout: hundreds of nested tables, one per comment, with a spacer picture for each indent and no author or date line. A Kindle book made from it was delivered in fixed layout. Reddit had its own conversion wired into the extraction path, and how a page was fetched (which address, which retriever, whether to retry through Cloudflare) was decided in several places.
After this change:
siteinterface (extractor/site.go) with a fixed list,redditandhackerNews.plan, with a table test of routing and precedence.POST /api/extract-htmlreads a Reddit or Hacker News page the client sends with the site's code, as it reads a fetched one.parser, naming what read the article:site:<name>,rule,readeck,readeck-hiddenormedia-only. It is omitted when empty. A site handler that cannot read a page logs a warning and leaves the page to the general parser.POST /api/content-parsed-wrongrefuses pages of hosts a site handler owns, listings included, since a selector rule there would replace the handler on every post.CLAUDE.mdis nowAGENTS.md, with a table of where a site-specific fix belongs.Verified: