NewsCrawler.org

Trying xeet, a Rust library that turns X posts into PNG images

X の投稿を Rust で画像にするライブラリ xeet を試す
Web のタイムラインの表示(ライト)
投稿の詳細の表示(ダーク)
iOS のタイムラインの表示(ダーク)
Image: zenn.dev

The author tried xeet, a Rust library that turns an X post into a PNG without a browser, to show X post cards on the landing page of their metronome app Metronome.fm.

Most tools of this kind open x.com in headless Chromium[1] and take a screenshot. xeet instead reimplements X's rendering in Rust, and its site says it matches X's fonts, emoji and line breaking. Its WebAssembly[2] core is under 3 MB compressed, and the site says PNGs are byte-identical on Linux, macOS and WebAssembly.

resolve() fetches a post from x.com without logging in and needs no API key, but it cannot get deleted posts or posts from locked accounts, and it may break if X changes its page. render() makes no network requests. The author drew the same post with Node, Rust and the CLI, and the PNG files had the same SHA-256[3] hash. A post with a video thumbnail took a median of 34 ms to render, and a text-only post took 3.0 ms. The WebAssembly file is 6.4 MB, or 2.1 MB after brotli[4] compression. The author noted that version 0.1.0 is new and the API may change, and concluded that xeet is enough for post cards on a landing page.

Read the original zenn.dev

Sources

  • Zenn JA

    X の投稿を Rust で画像にするライブラリ xeet を試す

    5 likes1 bookmark0 comments

Published: First seen: Читать по-русски

Open as a page