#Fixup x.com/Twitter & translate tweet

1 messages · Page 1 of 1 (latest)

tall silo
#

Fixup X/FxTwitter and translate tweet in the same commands

Use regex

Use Fixup X or Fxtwitter and translate the text to your language

X URL

Find:    (https:\/\/)x\.com(\/[^/]+\/[^/]+)(\$?.*)?$
Replace: $1fixupx.com$2$3/pt

Replace PT in "replace" to change to translate to your language

Twitter URL

Replace: $1fxtwitter.com$2$3/pt

Replace PT in "replace" to change to translate to your language

#

cool, thx. Here’s a merge of the two and other optimizations and fixes:

Find:
https:\/\/(twitter|x)\.com\/([^\s\)\]\}]+)

Replace:
https://fxtwitter.com/$2/pt

untested. lmk if you test it

prisma badger
#

when getting the x link in copy link in twitter is not translating

#

i think that need to remove this from the end of x link "?s=20"

tall silo
#

in case there ever are useful parameters, this should preserve them in the right place:

Find:
https:\/\/(twitter|x)\.com\/([^?\s\)\]\}]+)(\?[^\s\)\]\}]+)?

Replace:
https://fxtwitter.com/$2/pt$3

untested. lmk if you test it

#

but you can also purge them if you prefer, by omitting the $3 at the end of the replacement

prisma badger
#

let me test

tall silo
#

any idea what the s=20 means/does?

prisma badger
#

no, but s=20 is always inserted when you use copy link in a tweet

#

but your new replace, placing s=20 after /pt fixed the translation

#

but s=20 can be removed of the link too

tall silo
#

ty @ deleted msg:

https://fxtwitter.com/scorpionoxvoid/status/1202199959128309760/pt?s=20

[I think it's a tracker to determine the origin of the share.

?s=19 (from Android mobile devices)
?s=20 (from Windows devices)
?s=21 (from iOS devices, I think)]

tall silo
prisma badger
#

Yes, this first version suffered from this same problem, but thanks to you I saw what was causing it, I think it would be good for me to edit this first version and copy your corrected one in its place to prevent people from using a version that doesn't work 100% .

tall silo
#

yeah

shrewd notch
#

Here's a regex rule that checks if it's a status too; for both twitter and x

Find: http(?:s)?://(?:www\.)?(?:twitter|x)\.com(/[^/]+/status/\d+)
Replace: https://fxtwitter.com$1```
empty trellis
terse crypt
#

I personally did this regex which seems to do the job:

https:\/\/(twitter|x)\.com\/([^?\s\)\]\}]+)\/(\d+)

Especially in terms of only targeting URLs that actually are status ones (I think).
Not a regex expert, so don't know about any possible cases this wouldn't capture

#

Replace would be https://fxtwitter.com/$2/$3

terse crypt
#

Actually changed my setup to this:

Regex: https:\/\/(?:twitter|x)\.com\/(?<user>[a-zA-Z0-9_]{4,15})\/status\/(?<id>\d+)(?:\?.+)?
Result: https://fxtwitter.com/$<user>/status/$<id>

Gets rid of the tracking garbage and kinda validates users (Usernames can only be between 4 and 15 characters in length from what I gathered)

wheat bloom
#

I added onto the previously shared setup the ability to detect any extra parameters that fxtwitter supports (like embedding a specific image or translating the post) and figured I would share:

Regex:
https:\/\/(?:twitter|x)\.com\/(?<user>[a-zA-Z0-9_]{3,15})\/status\/(?<id>\d+)?(?:\?[^\/]+)?(\/{1})?
Replace:
https://fxtwitter.com/$<user>/status/$<id>/
stray valve
#

I added the ability to use the subdomains of fxtwitter for gallery, text-only and direct media

Regex: 
https:\/\/(?<type>[dgt]\.)?(?:twitter|x)\.com\/(?<user>[a-zA-Z0-9_]{4,15})\/status\/(?<id>\d+)?(?:\?[^\/]+)?(\/{1})?
Replace:
https://$<type>fxtwitter.com/$<user>/status/$<id>/
prisma badger
wheat bloom
prisma badger
#

Yes, i just found the answer, i fixed changing to 1,15, chatgpt helped me lol

#

But thanks anyway

cold cloak
#

English would be en right?