Problems with PeerTube ActivityPub API thumbnail paths

I’ve been playing around with ActivityPub APIs in an attempt to creating a useful basic app that allows users to choose which PeerTube servers they want to see content from.

I tried pulling PeerTube video information from https://my-sunshine.video/api/v1/videos?count=50 (Not necessary to be this specific server). This works, but I get objects that contain properties like previewPath and thumbnailPath which contain relative path values (eg /lazy-static/previews/7acb4f68-a887-4b55-8282-449297b8f8a4.jpg).

When I prepend the server instance hostname, I get a 404 and I see that these /lazy-static/... paths are meant for using cached images on servers (As mentioned here: Remote avatars not loading · Issue #5895 · Chocobozzz/PeerTube · GitHub.

My question is how can I get a thumbnail for a video as well as the creator avatar thumbnail when I’m not hosting a server myself?

Hi,

What is the server hostname you try to prepend? Can you give an example?

Hi, I’m currently pulling from "https://my-sunshine.video/api/v1/videos?count=50". An example of an item coming from there. When I take the item.previewPath and append it to the hostname https://spectra.video, I get a 404: https://spectra.video/lazy-static/previews/19d2695f-7c0e-4493-be92-73b13a469b75.jpg. Maybe I’m trying to access the preview path incorrectly, but if that’s the case, I’m wondering how I manage view the item.previewPath and item.avatars[0].path for example.

[
    {
        "account": {
            "id": 203155,
            "displayName": "Alesha Peterson",
            "name": "alesha_peterson",
            "url": "https://spectra.video/accounts/alesha_peterson",
            "host": "spectra.video",
            "avatars": [
                {
                    "width": 48,
                    "path": "/lazy-static/avatars/8915ef3f-a3a4-43de-853c-f5e5d22bba92.jpg",
                    "createdAt": "2024-01-18T03:48:47.263Z",
                    "updatedAt": "2024-09-15T08:20:24.210Z"
                },
                {
                    "width": 120,
                    "path": "/lazy-static/avatars/f332a849-768f-4fb5-8533-216b458cf23d.jpg",
                    "createdAt": "2024-01-18T03:48:47.266Z",
                    "updatedAt": "2024-03-18T23:03:45.367Z"
                }
            ]
        },
        "aspectRatio": 0.563,
        "category": {
            "id": null,
            "label": "Unknown"
        },
        "channel": {
            "id": 2818,
            "name": "aleshapeterson",
            "displayName": "AleshaPeterson",
            "url": "https://spectra.video/video-channels/aleshapeterson",
            "host": "spectra.video",
            "avatars": [
                {
                    "width": 48,
                    "path": "/lazy-static/avatars/e86187a3-ea5a-4bfa-b2ac-7e71a37fdade.jpg",
                    "createdAt": "2024-01-18T03:48:47.846Z",
                    "updatedAt": "2024-01-20T17:26:00.742Z"
                },
                {
                    "width": 120,
                    "path": "/lazy-static/avatars/5a1fbdbc-ab78-4baa-a446-dca099f1c779.jpg",
                    "createdAt": "2024-01-18T03:48:47.849Z",
                    "updatedAt": "2024-01-24T16:13:20.430Z"
                }
            ]
        },
        "createdAt": "2025-01-27T17:00:55.549Z",
        "description": "Originally uploaded December 15th, 2022 (It's clearly not 2022 anymore. Thanks for your patience as I upload over here. If you want current videos, go to my YT, but I rather you stay on here!) \r\n\r\nYouTube Link: https://youtube.com/shorts/5MPKDhNRs...",
        "dislikes": 0,
        "duration": 11,
        "embedPath": "/videos/embed/63cf758a-2797-4f73-a066-1436cf04eb86",
        "id": 88606,
        "isLive": false,
        "isLocal": false,
        "language": {
            "id": null,
            "label": "Unknown"
        },
        "licence": {
            "id": null,
            "label": "Unknown"
        },
        "likes": 0,
        "name": "#209. Part 2. Stop stressing or worrying about someone who won't even call you to see if you're good., 541056292_mp4",
        "nsfw": false,
        "originallyPublishedAt": null,
        "previewPath": "/lazy-static/previews/19d2695f-7c0e-4493-be92-73b13a469b75.jpg",
        "privacy": {
            "id": 1,
            "label": "Public"
        },
        "publishedAt": "2025-01-27T17:00:55.549Z",
        "shortUUID": "djRkLvEYi7Ame7EDsUDq3J",
        "thumbnailPath": "/lazy-static/thumbnails/ef623745-1aa7-4e9a-a00c-8d4a6c445c4b.jpg",
        "truncatedDescription": "Originally uploaded December 15th, 2022 (It's clearly not 2022 anymore. Thanks for your patience as I upload over here. If you want current videos, go to my YT, but I rather you stay on here!) \r\n\r\nYouTube Link: https://youtube.com/shorts/5MPKDhNRs...",
        "updatedAt": "2025-01-27T17:01:02.384Z",
        "url": "https://spectra.video/videos/watch/63cf758a-2797-4f73-a066-1436cf04eb86",
        "uuid": "63cf758a-2797-4f73-a066-1436cf04eb86",
        "viewers": 0,
        "views": 0
    }
]```

You must prepend the current hostname, and so my-sunshine.video :slight_smile:

Haha wow thanks so much. I guess I assumed the assets would all be on the host server of the video, but strange I didn’t try something else. Still learning though! Thanks again.