Aomitsu / UCode

A very simple Bluesky bot
GNU General Public License v3.0
1 stars 0 forks source link

Bluesky Client #3

Closed Aomitsu closed 1 year ago

Aomitsu commented 1 year ago

We need to create a Very lite but effective Bluesky client who can :

Aomitsu commented 1 year ago

J'ai déjà commencé dans la branche bsky_client, il faut juste que je m'intéresse à comment activer les embeds d'url

Un peu de doc utile :

Aomitsu commented 1 year ago

Example de post avec lien vers youtube.com

{
  "collection": "app.bsky.feed.post",
  "repo": "did:plc:reybf5lc55gwpx3gbliafeuu",
  "record": {
    "text": "www.youtube.com",
    "facets": [
      {
        "index": {
          "byteStart": 0,
          "byteEnd": 15
        },
        "features": [
          {
            "$type": "app.bsky.richtext.facet#link",
            "uri": "https://www.youtube.com/"
          }
        ]
      }
    ],
    "embed": {
      "$type": "app.bsky.embed.external",
      "external": {
        "uri": "https://www.youtube.com/",
        "title": "YouTube",
        "description": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.",
        "thumb": {
          "$type": "blob",
          "ref": {
            "$link": "bafkreidsezy3lcdwbfb32ilotjq6a5mnt65tudp5aap3sq72a5adsyze74"
          },
          "mimeType": "image/jpeg",
          "size": 186249
        }
      }
    },
    "langs": [
      "fr"
    ],
    "createdAt": "2023-10-29T19:25:15.994Z",
    "$type": "app.bsky.feed.post"
  }
}

On en conclus qu'on va devoir générer la card nous-même

Aomitsu commented 1 year ago

Pour envoyer une image au serveur :

POST https://bsky.social/xrpc/com.atproto.repo.uploadBlob AUTH content-type image/jpeg

body : full image

Il return un truc du type:

{
  "blob": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreifpwybccywxdp5or7k4tfshwdy5tf4zalr2leazzns3rv6vjal37m"
    },
    "mimeType": "image/jpeg",
    "size": 304318
  }
}