Unable to download instagram stories with self-hosted cobalt #237

Closed
opened 2025-11-09 09:43:55 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @MiraiSubject on GitHub (Apr 17, 2024).

bug description
When trying to download any instagram story (n=3) the error: "it seems like this service is not supported yet or your link is invalid. have you pasted the right link?" shows up in the self-hosted version of cobalt.

Example URL that does not work (as of posting story is 6h old): https://www.instagram.com/stories/sega/3348105858019674311/

Docker compose file

version: "3.5"
services:
  cobalt-api:
    image: ghcr.io/wukko/cobalt:7
    restart: unless-stopped
    container_name: cobalt-api
    init: true
    # if container doesn't run detached on your machine, uncomment the next line
    #tty: true

    ports:
      - 9000:9000/tcp
      # if you're using a reverse proxy, uncomment the next line and remove the one above (9000:9000/tcp):
      #- 127.0.0.1:9000:9000

    environment:
      # replace https://co.wuk.sh/ with your instance's target url in same format
      API_URL: http://myhostname.local:9000/
      # replace eu-nl with your instance's distinctive name
      API_NAME: myhostname
      # see docs/run-an-instance.md for more information
    labels:
      - com.centurylinklabs.watchtower.scope=cobalt
      # - ./cookies.json:/cookies.json
  cobalt-web:
    image: ghcr.io/wukko/cobalt:7
    restart: unless-stopped
    container_name: cobalt-web
    init: true
    # if container doesn't run detached on your machine, uncomment the next line
    #tty: true

    ports:
      - 9001:9001/tcp
      # if you're using a reverse proxy, uncomment the next line and remove the one above (9001:9001/tcp):
      #- 127.0.0.1:9001:9001

    environment:
      # replace https://cobalt.tools/ with your instance's target url in same format
      WEB_URL: https://myhostname.local:9001/ # replace https://co.wuk.sh/ with preferred api instance url
      API_URL: http://myhostname.local:9000/
    labels:
      - com.centurylinklabs.watchtower.scope=cobalt
  # update the cobalt image automatically with watchtower
  watchtower:
    image: ghcr.io/containrrr/watchtower
    restart: unless-stopped
    command: --cleanup --scope cobalt --interval 900
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
networks: {}

reproduction steps
steps to reproduce the behavior:

  1. Deploy the container using the above docker compose file
  2. Paste the story URL and click the arrows to download
  3. Observe:
    CleanShot 2024-04-17 at 18 11 19

screenshots

links
https://www.instagram.com/stories/sega/3348105858019674311/
https://www.instagram.com/stories/heyitssharla/3348111419970427324/

platform

  • Server OS: Debian / DIetPi 9.3.1
  • Client OS: macOS Sonoma
  • Browser: Safari & Firefox 125

additional context
Downloading the stories does work from https://cobalt.tools/

I also made sure to run docker compose pull and docker compose up -d to ensure I have the latest version based on that the instagram endpoints got changed: https://github.com/wukko/cobalt/commit/6d17ff2e06120626cb88fb55622a0f1e26c71bf3

CleanShot 2024-04-17 at 18 16 42

Also downloading images and reels still work as expected.

Originally created by @MiraiSubject on GitHub (Apr 17, 2024). **bug description** When trying to download any instagram story (n=3) the error: "it seems like this service is not supported yet or your link is invalid. have you pasted the right link?" shows up in the self-hosted version of cobalt. Example URL that does not work (as of posting story is 6h old): https://www.instagram.com/stories/sega/3348105858019674311/ <details><summary>Docker compose file</summary> <p> ```yaml version: "3.5" services: cobalt-api: image: ghcr.io/wukko/cobalt:7 restart: unless-stopped container_name: cobalt-api init: true # if container doesn't run detached on your machine, uncomment the next line #tty: true ports: - 9000:9000/tcp # if you're using a reverse proxy, uncomment the next line and remove the one above (9000:9000/tcp): #- 127.0.0.1:9000:9000 environment: # replace https://co.wuk.sh/ with your instance's target url in same format API_URL: http://myhostname.local:9000/ # replace eu-nl with your instance's distinctive name API_NAME: myhostname # see docs/run-an-instance.md for more information labels: - com.centurylinklabs.watchtower.scope=cobalt # - ./cookies.json:/cookies.json cobalt-web: image: ghcr.io/wukko/cobalt:7 restart: unless-stopped container_name: cobalt-web init: true # if container doesn't run detached on your machine, uncomment the next line #tty: true ports: - 9001:9001/tcp # if you're using a reverse proxy, uncomment the next line and remove the one above (9001:9001/tcp): #- 127.0.0.1:9001:9001 environment: # replace https://cobalt.tools/ with your instance's target url in same format WEB_URL: https://myhostname.local:9001/ # replace https://co.wuk.sh/ with preferred api instance url API_URL: http://myhostname.local:9000/ labels: - com.centurylinklabs.watchtower.scope=cobalt # update the cobalt image automatically with watchtower watchtower: image: ghcr.io/containrrr/watchtower restart: unless-stopped command: --cleanup --scope cobalt --interval 900 volumes: - /var/run/docker.sock:/var/run/docker.sock networks: {} ``` </p> </details> **reproduction steps** steps to reproduce the behavior: 1. Deploy the container using the above docker compose file 2. Paste the story URL and click the arrows to download 3. Observe: ![CleanShot 2024-04-17 at 18 11 19](https://github.com/wukko/cobalt/assets/803255/efa85c7a-c05a-45a5-b000-86f3fc60fcf2) **screenshots** **links** https://www.instagram.com/stories/sega/3348105858019674311/ https://www.instagram.com/stories/heyitssharla/3348111419970427324/ **platform** - Server OS: Debian / DIetPi 9.3.1 - Client OS: macOS Sonoma - Browser: Safari & Firefox 125 **additional context** Downloading the stories does work from https://cobalt.tools/ I also made sure to run `docker compose pull` and `docker compose up -d` to ensure I have the latest version based on that the instagram endpoints got changed: https://github.com/wukko/cobalt/commit/6d17ff2e06120626cb88fb55622a0f1e26c71bf3 ![CleanShot 2024-04-17 at 18 16 42](https://github.com/wukko/cobalt/assets/803255/b0dfb31b-b532-4a84-85ac-629d95136762) Also downloading images and reels still work as expected.
GiteaMirror added the bug label 2025-11-09 09:43:55 -06:00
Author
Owner

@wukko commented on GitHub (Apr 17, 2024):

have you added dummy account cookies? stories don't work without them iirc

@wukko commented on GitHub (Apr 17, 2024): have you added dummy account cookies? stories don't work without them iirc
Author
Owner

@MiraiSubject commented on GitHub (Apr 17, 2024):

Oops forgot to specify that. Yes. I had cookies initially enabled by using my own account's cookies in the file. To troubleshoot this issue I had removed the cookies file from the volume.

@MiraiSubject commented on GitHub (Apr 17, 2024): Oops forgot to specify that. Yes. I had cookies initially enabled by using my own account's cookies in the file. To troubleshoot this issue I had removed the cookies file from the volume.
Author
Owner

@MiraiSubject commented on GitHub (Apr 17, 2024):

I realised I vimmed a bit too hard and noticed that the cookies.json was under labels and volumes was completely gone. So I rectified that and entered the API container's shell to ensure the file was there by catting it.

CleanShot 2024-04-17 at 19 39 22

I grabbed all my cookies off a request and ran into trouble getting it properly in the json string cause there's nested quotes and backslashes that needed escaping (like in the rur shbid,shbts). I managed to get those escaped and still couldn't download a private post. I then proceeded to remove those 3 from the string in the cookies file, and that also didn't result in success.

After that I only filled in the fields that the documentation asks for, so these KV pairs: mid=<replace>; ig_did=<with>; csrftoken=<your>; ds_user_id=<own>; sessionid=<cookies> and no success either. I made sure they were in the correct order just in case that mattered.

In between every change I ran docker compose down && docker compose up -d

Anyway it turns out COOKIE_PATH was missing in the environment:

environment:
      # replace https://co.wuk.sh/ with your instance's target url in same format
      API_URL: http://herta.local:9000/
      # replace eu-nl with your instance's distinctive name
      API_NAME: herta
      # see docs/run-an-instance.md for more information
      COOKIE_PATH: "/cookies.json"

So it's a PEBCAK issue, but imo a COOKIE_PATH example should also be included in the compose file if a volume suggestion for it is offered, or alternatively, in the app try to read COOKIE_PATH and if it doesn't exist read /cookies.json. I didn't read the table at the bottom under the docker compose section and I actually found this out from cloning the source code and searching for cookie lol

@MiraiSubject commented on GitHub (Apr 17, 2024): I realised I vimmed a bit too hard and noticed that the cookies.json was under labels and volumes was completely gone. So I rectified that and entered the API container's shell to ensure the file was there by catting it. ![CleanShot 2024-04-17 at 19 39 22](https://github.com/wukko/cobalt/assets/803255/f7982656-9050-4544-b561-ae6b510a75cb) I grabbed all my cookies off a request and ran into trouble getting it properly in the json string cause there's nested quotes and backslashes that needed escaping (like in the `rur` `shbid`,`shbts`). I managed to get those escaped and still couldn't download a private post. I then proceeded to remove those 3 from the string in the cookies file, and that also didn't result in success. After that I only filled in the fields that the documentation asks for, so these KV pairs: `mid=<replace>; ig_did=<with>; csrftoken=<your>; ds_user_id=<own>; sessionid=<cookies>` and no success either. I made sure they were in the correct order just in case that mattered. In between every change I ran `docker compose down && docker compose up -d` Anyway it turns out COOKIE_PATH was missing in the environment: ```yaml environment: # replace https://co.wuk.sh/ with your instance's target url in same format API_URL: http://herta.local:9000/ # replace eu-nl with your instance's distinctive name API_NAME: herta # see docs/run-an-instance.md for more information COOKIE_PATH: "/cookies.json" ``` So it's a PEBCAK issue, but imo a COOKIE_PATH example should also be included in the compose file if a volume suggestion for it is offered, or alternatively, in the app try to read COOKIE_PATH and if it doesn't exist read /cookies.json. I didn't read the table at the bottom under the docker compose section and I actually found this out from cloning the source code and searching for cookie lol
Sign in to join this conversation.