subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 686 forks source link

Implement animated_media obj in DirectMessage class #673

Closed ghrlt closed 2 years ago

ghrlt commented 2 years ago

Hi!

I am working with direct messages, and to my disappointment, I remarked that animated_media object are not taken into account and thus, I cannot work on them.

instagrapi return this obj (.__dict__)

{
  "id": "30495315030332469520564164709318656",
  "user_id": 44404267539,
  "thread_id": 340282366841710300949128168802123352654,
  "timestamp": datetime.datetime(2022, 5, 21, 17, 32, 20, 325816, tzinfo=datetime.timezone.utc),
  "item_type": "animated_media",
  "is_shh_mode": false,
  "reactions": null,
  "text": null,
  "link": null,
  "media": null,
  "media_share": null,
  "reel_share": null,
  "story_share": null,
  "felix_share": null,
  "clip": null,
  "placeholder": null
}

while the instagram API return this

{
  "item_type":"animated_media",
  "animated_media":{
    "id":"Lq1VhHQxityfPucqg1",
    "is_random":false,
    "is_sticker":false,
    "images":{
      "fixed_height":{
        "height":"200",
        "width":"273",
        "size":"750866",
        "url":"https://media2.giphy.com/media/v1.Y2lkPTQyMzA0NmQwYWRkOWZiOTU3ZTg2NTFjNzUyMzZlZjhjYTIyMjAyYWJjYmVlYzYzMSZjdD1n/Lq1VhHQxityfPucqg1/200.gif",
        "mp4":"https://media2.giphy.com/media/v1.Y2lkPTQyMzA0NmQwYWRkOWZiOTU3ZTg2NTFjNzUyMzZlZjhjYTIyMjAyYWJjYmVlYzYzMSZjdD1n/Lq1VhHQxityfPucqg1/200.mp4",
        "mp4_size":"209229",
        "webp":"https://media2.giphy.com/media/v1.Y2lkPTQyMzA0NmQwYWRkOWZiOTU3ZTg2NTFjNzUyMzZlZjhjYTIyMjAyYWJjYmVlYzYzMSZjdD1n/Lq1VhHQxityfPucqg1/200.webp",
        "webp_size":"477754"
      }
    },
    "user":{
      "is_verified":true,
      "username":"fleischerstudios"
    }
  },
  "client_context":"6933800370894859029",
  "is_sent_by_viewer":true,
  "is_shh_mode":false,
  "item_id":"30495176560858445286220178766430208",
  "show_forward_attribution":false,
  "timestamp":1653146833880588,
  "user_id":44404267539,
  "tq_seq_id":46,
  "uq_seq_id":197936
}

I would be very thankful to anyone who's able to implement it asap!

ghrlt commented 2 years ago

See PR #674