snarfed / bridgy-fed

🌉 A bridge between decentralized social network protocols
https://fed.brid.gy
Creative Commons Zero v1.0 Universal
662 stars 34 forks source link

support PeerTube #471

Open snarfed opened 1 year ago

snarfed commented 1 year ago

Fediverse YouTube!

Not sure how much we currently interop, but we did hit this error today when fetching this video post and converting it to AS1.

snarfed commented 1 year ago

Example AS2, for https://spectra.video/videos/watch/1484abab-d649-45d0-8c50-d761382ac4e7 . A few thoughts on first glance:

{
   "@context" : ["..."],
   "attributedTo" : [
      {
         "id" : "https://spectra.video/accounts/xjix",
         "type" : "Person"
      },
      {
         "id" : "https://spectra.video/video-channels/trashpandapunk",
         "type" : "Group"
      }
   ],
   "category" : {
      "identifier" : "11",
      "name" : "News & Politics"
   },
   "cc" : [
      "https://spectra.video/accounts/xjix/followers"
   ],
   "comments" : "https://spectra.video/videos/watch/1484abab-d649-45d0-8c50-d761382ac4e7/comments",
   "commentsEnabled" : true,
   "content" : "all you have to do is destroy the entire ecosystem and genocide everyone you encounter along the way! (sarcasm don't do this, tis bad)",
   "dislikes" : "https://spectra.video/videos/watch/1484abab-d649-45d0-8c50-d761382ac4e7/dislikes",
   "downloadEnabled" : true,
   "duration" : "PT59S",
   "icon" : [
      {
         "height" : 157,
         "mediaType" : "image/jpeg",
         "type" : "Image",
         "url" : "https://spectra.video/static/thumbnails/8ca04a4a-72f6-45b5-a871-08dddbc213bc.jpg",
         "width" : 280
      },
      {
         "height" : 480,
         "mediaType" : "image/jpeg",
         "type" : "Image",
         "url" : "https://spectra.video/lazy-static/previews/52558f8c-fb0c-40aa-8a58-cd739b273195.jpg",
         "width" : 850
      }
   ],
   "id" : "https://spectra.video/videos/watch/1484abab-d649-45d0-8c50-d761382ac4e7",
   "isLiveBroadcast" : false,
   "language" : {
      "identifier" : "en",
      "name" : "English"
   },
   "latencyMode" : null,
   "licence" : {
      "identifier" : "2",
      "name" : "CC BY-SA 4.0"
   },
   "likes" : "https://spectra.video/videos/watch/1484abab-d649-45d0-8c50-d761382ac4e7/likes",
   "liveSaveReplay" : null,
   "mediaType" : "text/markdown",
   "name" : "How to conquer a continent",
   "originallyPublishedAt" : null,
   "permanentLive" : null,
   "published" : "2023-03-25T00:53:20.675Z",
   "sensitive" : false,
   "shares" : "https://spectra.video/videos/watch/1484abab-d649-45d0-8c50-d761382ac4e7/announces",
   "state" : 1,
   "subtitleLanguage" : [],
   "support" : "https://ko-fi.com/trashpandapunk",
   "tag" : [
      {
         "name" : "shorts",
         "type" : "Hashtag"
      },
      {
         "name" : "tiktok",
         "type" : "Hashtag"
      }
   ],
   "to" : [
      "https://www.w3.org/ns/activitystreams#Public"
   ],
   "type" : "Video",
   "updated" : "2023-03-31T12:01:20.291Z",
   "url" : [
      {
         "href" : "https://spectra.video/videos/watch/1484abab-d649-45d0-8c50-d761382ac4e7",
         "mediaType" : "text/html",
         "type" : "Link"
      },
      {
         "href" : "https://spectra-prod.us-east-1.linodeobjects.com/streaming-playlists/hls/1484abab-d649-45d0-8c50-d761382ac4e7/c795d898-520c-43b8-9601-89e45b1059da-master.m3u8",
         "mediaType" : "application/x-mpegURL",
         "tag" : [
            {
               "name" : "b02fcf5af6e2a6b908548ffeb64954dfe97d9792",
               "type" : "Infohash"
            },
            {
               "name" : "51a48b8ccc6b75fec4ab465270f0d51756cc94a3",
               "type" : "Infohash"
            },
            {
               "href" : "https://spectra-prod.us-east-1.linodeobjects.com/streaming-playlists/hls/1484abab-d649-45d0-8c50-d761382ac4e7/1e62bab8-15d6-46b8-b1f4-5f5898099393-segments-sha256.json",
               "mediaType" : "application/json",
               "name" : "sha256",
               "type" : "Link"
            },
            {
               "fps" : 30,
               "height" : 720,
               "href" : "https://spectra-prod.us-east-1.linodeobjects.com/streaming-playlists/hls/1484abab-d649-45d0-8c50-d761382ac4e7/290ff400-eb58-4fcb-8ea4-e5df06313f34-720-fragmented.mp4",
               "mediaType" : "video/mp4",
               "size" : 14682664,
               "type" : "Link"
            },
            {
               "fps" : 30,
               "height" : 720,
               "href" : "https://spectra.video/api/v1/videos/1484abab-d649-45d0-8c50-d761382ac4e7/metadata/236438",
               "mediaType" : "application/json",
               "rel" : [
                  "metadata",
                  "video/mp4"
               ],
               "type" : "Link"
            },
            {
               "height" : 720,
               "href" : "https://spectra.video/lazy-static/torrents/6c6e828e-7416-4dbc-a0f6-84ed7645d541-720-hls.torrent",
               "mediaType" : "application/x-bittorrent",
               "type" : "Link"
            },
            {
               "height" : 720,
               "href" : "magnet:?xs=https%3A%2F%2Fspectra.video%2Flazy-static%2Ftorrents%2F6c6e828e-7416-4dbc-a0f6-84ed7645d541-720-hls.torrent&xt=urn:btih:1d1bed3cb87b51a383bef69f0c9189afa83c1cfd&dn=How+to+conquer+a+continent&tr=https%3A%2F%2Fspectra.video%2Ftracker%2Fannounce&tr=wss%3A%2F%2Fspectra.video%3A443%2Ftracker%2Fsocket&ws=https%3A%2F%2Fspectra-prod.us-east-1.linodeobjects.com%2Fstreaming-playlists%2Fhls%2F1484abab-d649-45d0-8c50-d761382ac4e7%2F290ff400-eb58-4fcb-8ea4-e5df06313f34-720-fragmented.mp4",
               "mediaType" : "application/x-bittorrent;x-scheme-handler/magnet",
               "type" : "Link"
            },
            {
               "fps" : 30,
               "height" : 360,
               "href" : "https://spectra-prod.us-east-1.linodeobjects.com/streaming-playlists/hls/1484abab-d649-45d0-8c50-d761382ac4e7/c80e1079-5676-47ca-af7d-4de7f7aab140-360-fragmented.mp4",
               "mediaType" : "video/mp4",
               "size" : 4655643,
               "type" : "Link"
            },
            {
               "fps" : 30,
               "height" : 360,
               "href" : "https://spectra.video/api/v1/videos/1484abab-d649-45d0-8c50-d761382ac4e7/metadata/236440",
               "mediaType" : "application/json",
               "rel" : [
                  "metadata",
                  "video/mp4"
               ],
               "type" : "Link"
            },
            {
               "height" : 360,
               "href" : "https://spectra.video/lazy-static/torrents/1c5f53f1-8b6d-424b-9fdf-77b2fcb32bad-360-hls.torrent",
               "mediaType" : "application/x-bittorrent",
               "type" : "Link"
            },
            {
               "height" : 360,
               "href" : "magnet:?xs=https%3A%2F%2Fspectra.video%2Flazy-static%2Ftorrents%2F1c5f53f1-8b6d-424b-9fdf-77b2fcb32bad-360-hls.torrent&xt=urn:btih:68973e1c80117656e60d962d3931d96e4102988f&dn=How+to+conquer+a+continent&tr=https%3A%2F%2Fspectra.video%2Ftracker%2Fannounce&tr=wss%3A%2F%2Fspectra.video%3A443%2Ftracker%2Fsocket&ws=https%3A%2F%2Fspectra-prod.us-east-1.linodeobjects.com%2Fstreaming-playlists%2Fhls%2F1484abab-d649-45d0-8c50-d761382ac4e7%2Fc80e1079-5676-47ca-af7d-4de7f7aab140-360-fragmented.mp4",
               "mediaType" : "application/x-bittorrent;x-scheme-handler/magnet",
               "type" : "Link"
            }
         ],
         "type" : "Link"
      },
      {
         "href" : "https://spectra.video/tracker/announce",
         "name" : "tracker-http",
         "rel" : [
            "tracker",
            "http"
         ],
         "type" : "Link"
      },
      {
         "href" : "wss://spectra.video:443/tracker/socket",
         "name" : "tracker-websocket",
         "rel" : [
            "tracker",
            "websocket"
         ],
         "type" : "Link"
      }
   ],
   "uuid" : "1484abab-d649-45d0-8c50-d761382ac4e7",
   "views" : 9,
   "waitTranscoding" : true
}
snarfed commented 6 months ago

Tried a Like of a video just now, PeerTube choked on our HTTP Signature with 403 ActivityPub signature could not be checked. Full log:

Running send task 7814178890099621783
Params: [('obj', 'ahBicmlkZ3ktZmVkZXJhdGVkcnMLEgZPYmplY3QiZ2h0dHBzOi8vc25hcmZlZC5vcmcvMjAyNC0wNC0zMF9idWlsZGluZy1icmlkZ2VzLXRvLXRoZS1mZWRpdmVyc2Utd2l0aC1yeWFuLWJhcnJldHQtZmxpcGJvYXJkLXBlZXJ0dWJlLTIM'), ('orig_obj', 'ahBicmlkZ3ktZmVkZXJhdGVkckoLEgZPYmplY3QiPmh0dHBzOi8vZmxpcGJvYXJkLnZpZGVvL3cvMGUwMTgwYjMtODFlNy00N2I5LTk4NTMtYTA2YWU0NDg0ZDI3DA'), ('protocol', 'activitypub'), ('url', 'https://flipboard.video/accounts/flipboard/inbox'), ('user', 'ahBicmlkZ3ktZmVkZXJhdGVkchkLEghNYWdpY0tleSILc25hcmZlZC5vcmcM')]
Sending https://snarfed.org/2024-04-30_building-bridges-to-the-fediverse-with-ryan-barrett-flipboard-peertube-2 AS1: {
  "objectType": "activity",
  "verb": "like",
  "published": "2024-04-30T21:08:49-07:00",
  "content": "Likes <a class=\"u-like-of\" href=\"https://flipboard.video/w/0e0180b3-81e7-47b9-9853-a06ae4484d27\">https://flipboard.video/w/0e0180b3-81e7-47b9-9853-a06ae4484d27</a>.\n<div class=\"e-content\">\nBuilding Bridges to the Fediverse, with Ryan Barrett – Flipboard PeerTube\n</div>",
  "url": "https://snarfed.org/2024-04-30_building-bridges-to-the-fediverse-with-ryan-barrett-flipboard-peertube-2",
  "object": "https://flipboard.video/w/0e0180b3-81e7-47b9-9853-a06ae4484d27",
  "actor": {
    "objectType": "person",
    "displayName": "Ryan Barrett",
    "url": "https://snarfed.org/",
    "image": [
      {
        "url": "https://secure.gravatar.com/avatar/947b5f3f323da0ef785b6f02d9c265d6?s=96&d=blank&r=g"
      }
    ],
    "id": "snarfed.org"
  },
  "id": "https://snarfed.org/2024-04-30_building-bridges-to-the-fediverse-with-ryan-barrett-flipboard-peertube-2"
}
ActivityStreams 1 only supports single author; dropping extra attributedTo values: [{'type': 'Group', 'id': 'https://flipboard.video/video-channels/dot_social'}]
Determining protocol for id https://snarfed.org/2024-04-30_building-bridges-to-the-fediverse-with-ryan-barrett-flipboard-peertube-2
  Key('Object', 'https://snarfed.org/2024-04-30_building-bridges-to-the-fediverse-with-ryan-barrett-flipboard-peertube-2') owned by source_protocol web
Sending AS2 object: {
  "published": "2024-04-30T21:08:49-07:00",
  "content": "Likes <a class=\"u-like-of\" href=\"https://flipboard.video/w/0e0180b3-81e7-47b9-9853-a06ae4484d27\">https://flipboard.video/w/0e0180b3-81e7-47b9-9853-a06ae4484d27</a>.\n<div class=\"e-content\">\nBuilding Bridges to the Fediverse, with Ryan Barrett – Flipboard PeerTube\n</div>",
  "url": "https://fed.brid.gy/r/https://snarfed.org/2024-04-30_building-bridges-to-the-fediverse-with-ryan-barrett-flipboard-peertube-2",
  "actor": "https://fed.brid.gy/snarfed.org",
  "id": "https://fed.brid.gy/r/https://snarfed.org/2024-04-30_building-bridges-to-the-fediverse-with-ryan-barrett-flipboard-peertube-2",
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Like",
  "object": "https://flipboard.video/videos/watch/0e0180b3-81e7-47b9-9853-a06ae4484d27",
  "cc": [
    "https://flipboard.video/accounts/flipboard",
    "https://flipboard.video/video-channels/dot_social",
    "https://www.w3.org/ns/activitystreams#Public",
    "https://flipboard.video/accounts/flipboard/followers"
  ],
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "contentMap": {
    "en": "Likes <a class=\"u-like-of\" href=\"https://flipboard.video/w/0e0180b3-81e7-47b9-9853-a06ae4484d27\">https://flipboard.video/w/0e0180b3-81e7-47b9-9853-a06ae4484d27</a>.\n<div class=\"e-content\">\nBuilding Bridges to the Fediverse, with Ryan Barrett – Flipboard PeerTube\n</div>"
  }
}
Signing with Key('MagicKey', 'snarfed.org')'s key
requests.post https://flipboard.video/accounts/flipboard/inbox {'data': b'...', 'auth': <httpsig.requests_auth.HTTPSignatureAuth object at 0x3e42a68b64d0>, 'headers': {'Date': '...', 'Host': '...', 'Content-Type': '...', 'Digest': '...'}, 'gateway': True}
Received 403: {
  "type": "about:blank",
  "title": "Forbidden",
  "detail": "ActivityPub signature could not be checked",
  "status": 403,
  "error": "ActivityPub signature could not be checked"
}
snarfed commented 3 months ago

Progress here! We're now successfully federating replies and likes out to Peertube. Example: https://spectra.video/w/nVQAzfWyC64DUfqGQcnCfp