feature request: Configurable URL preview scraper user-agent #1364

Closed
opened 2026-02-12 19:48:44 +00:00 by gan · 4 comments

(Conversation reference), a person experienced an issue with generating a preview/embed off xwitter embed generator service (i.e., FxEmbed) because Continuwuity's request isn't treated as a bot request thus causing the preview generation to fail because of a redirect, this is not the case for Synapse, examples:

  • curl -iA "continuwuity/0.5.4 (1914616)" "https://fxtwitter.com/scarytoilet/status/1140686354403213314" (returns 302 Found);
  • curl -iA "Synapse (bot; +https://github.com/matrix-org/synapse)" "https://fxtwitter.com/scarytoilet/status/1140686354403213314" (returns the content necessary for an embed).

it's properly returned for synapse because it contains "bot" in its user-agent (the regex used by FxEmbed).

I believe lack of the "bot" declaration within the user-agent may cause some other preview generations off other services to fail as well, so, there might be a desire to allow control of a user agent for preview generation or globally.

[(Conversation reference)](matrix:roomid/da26JtAjE6APGLnX8ncWsvc-skF2KQZ9Nw_MbNpYD2k/e/Os6xEWjNqpu4JjOrVRjD2gZRRJZui5kiw8b7VAipTN8?via=explodie.org&via=explodie.org&via=continuwuity.org), a person experienced an issue with generating a preview/embed off xwitter embed generator service (i.e., FxEmbed) because Continuwuity's request isn't treated as a bot request thus causing the preview generation to fail because of a redirect, this is not the case for Synapse, examples: * `curl -iA "continuwuity/0.5.4 (1914616)" "https://fxtwitter.com/scarytoilet/status/1140686354403213314"` (returns `302 Found`); * `curl -iA "Synapse (bot; +https://github.com/matrix-org/synapse)" "https://fxtwitter.com/scarytoilet/status/1140686354403213314"` (returns the content necessary for an embed). it's properly returned for synapse because it contains "bot" in its user-agent (the regex used by [FxEmbed](https://github.com/FxEmbed/FxEmbed/blob/main/src/constants.ts#L31)). I believe lack of the "bot" declaration within the user-agent may cause some other preview generations off other services to fail as well, so, there might be a desire to allow control of a user agent for preview generation or globally.
Owner

Having a configurable user agent in the config file probably wouldn't be too hard

Having a configurable user agent in the config file probably wouldn't be too hard
nex changed title from An ablity to set user-agent globally or for the preview generator to feature request: Configurable URL preview scraper user-agent 2026-02-12 22:06:10 +00:00
Contributor

matrix-media-repo is also in the "approved" FxEmbed regexes

would having a configuration value with that as the DEFAULT be potentially harmful in anyway? Seems relatively benign, but I'm also new here, so the others can speak more to the project's inner workings.

It would definitely be good to see previews better supported!

# This also works
curl -iA "continuwuity/0.5.4 (1914616) [UA=matrix-media-repo]" "https://fxtwitter.com/scarytoilet/status/1140686354403213314"
`matrix-media-repo` is also in the "approved" FxEmbed regexes would having a configuration value with that as the DEFAULT be potentially harmful in anyway? Seems relatively benign, but I'm also new here, so the others can speak more to the project's inner workings. It would definitely be good to see previews better supported! ```shell # This also works curl -iA "continuwuity/0.5.4 (1914616) [UA=matrix-media-repo]" "https://fxtwitter.com/scarytoilet/status/1140686354403213314" ```
Owner

bot and embed are in there and would be better

[bot and embed are in there](https://github.com/FxEmbed/FxEmbed/blob/03b3481054c6ef662eb8dda986039f2d37dd525c/src/constants.ts#L32) and would be better
Owner

for URL previews something like continuwuity/0.5.4+1914616 (embedbot; +https://continuwuity.org) would probably be best

for URL previews something like `continuwuity/0.5.4+1914616 (embedbot; +https://continuwuity.org)` would probably be best
Jade closed this issue 2026-02-15 15:23:35 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity#1364
No description provided.