mautrix / twitter

A Matrix-Twitter DM puppeting bridge
GNU Affero General Public License v3.0
81 stars 19 forks source link

Fixes downloading media #40

Closed javiercr closed 3 months ago

javiercr commented 3 months ago

Twitter is now using https://ton.x.com/i/ton/[...] for media sent over DM, despite their API still returning urls using https://ton.twitter.com/1.1/ton/[...].

They do the same replace proposed in this PR in their own JS bundle:

image

https://abs.twimg.com/responsive-web/client-web/main.87b67eda.js

javiercr commented 3 months ago

As a side note: the old URL returns a 302 redirect to the new one, problem was that the HTTP client we use was not passing the cookies to the new URL. To avoid the extra HTTP call (redirected) I just fixed the first call as they do.