instagrapi icon indicating copy to clipboard operation
instagrapi copied to clipboard

[BUG] user is not being tagged in post

Open Anurag-Varma opened this issue 4 years ago • 2 comments

Describe the bug The tagged user is not being tagged, the tag is showing empty list in media.dict() also.

To Reproduce

from instagrapi import Client
from instagrapi.types import Usertag

cl = Client()
cl.login(USERNAME, PASSWORD)

adw0rd = cl.user_info_by_username('adw0rd')
media = cl.photo_upload(
    "/app/image.jpg",
    "Test caption for photo with #hashtags and mention users such @adw0rd",
    usertags=[Usertag(user=adw0rd, x=0.5, y=0.5)]
)

media.dict()

if x,y values are changed like below, it gives invalid user. usertags=[Usertag(user=adw0rd, x=5, y=5)]

Expected behavior Tag the user in post

Desktop (please complete the following information):

  • OS: Ubuntu 20
  • Python version 3.8
  • instagrapi version 1.16.29

Anurag-Varma avatar Oct 16 '22 07:10 Anurag-Varma

Rechecked this on the current code with a reusable live session; keeping it open as a reproducible bug.

Current behavior: photo_configure() sends usertags as {"in": [{"user_id": ..., "position": [0.5, 0.5]}]} and Instagram returns status="ok", but the returned media.usertags is empty. Polling media_info_v1() for the uploaded photo 8 times still returned no usertags. I repeated the probe with a public target account (instagram) to rule out target-account privacy, and cleanup deleted the test media afterward.

Local regression checks for the existing upload/media parsing path still pass (tests/regression/test_upload.py tests/regression/test_media.py), so this looks like current Instagram single-photo configure behavior or payload drift rather than the old extractor losing tags. Album per-slide usertags have separate live coverage, but single-photo usertags need a current app capture before changing the request shape safely.

subzeroid avatar Jun 16 '26 22:06 subzeroid

Fixed and released in instagrapi 2.16.10: https://github.com/subzeroid/instagrapi/releases/tag/2.16.10

Root cause: current single-photo media/configure accepts the usertags payload, but Instagram can still return/read back the uploaded photo without those tags. photo_upload(..., usertags=[...]) now detects that case and applies the same tags through media_edit, then returns the updated media.

Also mirrored in aiograpi 1.10.10: https://github.com/subzeroid/aiograpi/releases/tag/1.10.10

The fix is covered by regression tests and live readback tests for single-photo usertags. Closing this as completed.

subzeroid avatar Jun 18 '26 22:06 subzeroid