louisgrasset / touitomamout

Touitomamout is an easy way to synchronize your Twitter's tweets 🦤 to Mastodon 🦣 and Bluesky post ☁️ (also known as Twitter to Mastodon & Bluesky crossposter)
https://hub.docker.com/r/louisgrasset/touitomamout
GNU Affero General Public License v3.0
120 stars 7 forks source link

XRPCError: Invalid app.bsky.feed.post record: Record/text must not be longer than 300 graphemes #115

Closed kai17 closed 10 months ago

kai17 commented 10 months ago

With the latest version (commit cceb9d), touitomamout pulls the tweets from https://twitter.com/kai_arzheimer and reposts them at https://bsky.app/profile/kaiarzheimer.bsky.social. However, it chokes on this tweet https://twitter.com/kai_arzheimer/status/1716520276488249713 with an error about using more than 300 graphemes (the tweet is definitively shorter). The script than hangs for a few seconds before terminating. My more recent tweets do not get synchronised. Instead, my older tweets get duplicated on Bluesky.

louisgrasset commented 10 months ago

I'll look into that. I added some checks in the codebase, they are already passing... 🤔

louisgrasset commented 10 months ago

A fixed has been merge regarding the duplication. It was related to a cache migration failure. If you want to start the sync from a specific tweet, you can add the following in your cache file:

{
...
posts: {
    ...
    "yourTweetIdHere": {
       mastodon: ["correspondingMastodonId"]
    }
    ...
}
...
}
kai17 commented 10 months ago

Thank you again. I just pulled from github and ran the script again, but the result is the same (see the attached screenshot). The first part of the tweet (w/ot the link) is posted again on Bluesky (now for the 9th time), then the script hangs for a few seconds and terminates. Should I try deleting the cache and/or reinstall from scratch? screenshot

louisgrasset commented 10 months ago

Sounds like the AtProto relies on Graphemer to count text length, not on a simple string.length.

From what I see, the atProto checks the text length using the following code:

// counts the number of graphemes (user-displayed characters) in a string
export const graphemeLen = (str: string): number => {
  const splitter = new Graphemer()
  return splitter.countGraphemes(str)
}

Thanks to your issue & details, I'll try to reproduce & find a fix

louisgrasset commented 10 months ago

@kai17 I let you test the latest codebase or dev tag on docker

Feel free to reopen