Kevin Chen

Adding a Text-Only Endpoint to Paperbin

Hit a wall trying to get my Xteink X4 (ESP32-based e-ink reader) to pull articles from Paperbin.

The problem: ArduinoJson was choking on the API response. Paperbin returns full HTML content from Feedbin’s parser, sometimes 18KB+ per article. ESP32 only has so much RAM, and ArduinoJson needs to hold the entire parsed JSON in memory. Even with streaming, the huge content field was blowing past the heap limit.

The fix was obvious in hindsight—strip the HTML server-side. Added a ?format=text parameter to the /api/article endpoint. When set, Paperbin runs the content through a simple regex-based HTML stripper before returning it. No tags, no styling, just the text.

/api/article?pos=0              → HTML content (~18KB)
/api/article?pos=0&format=text  → plain text (~3KB)

Payload dropped by ~80%. ESP32 handles it fine now.

The text output isn’t perfect—loses formatting, links become invisible, code blocks flatten out. But for reading articles on a tiny e-ink screen, it’s good enough. Could add Markdown output later if I care enough.

Links: Paperbin on GitHub

#Home Lab