subzeroid / instagrapi

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

[BUG] When I use track_info_by_canonical_id method get 'NoneType' object has no attribute 'get'error #1484

Closed rzashakeri closed 1 year ago

rzashakeri commented 1 year ago

hi when i use client.track_info_by_canonical_id(music_id).dict() get'NoneType' object has no attribute 'get' error

AttributeError: 'NoneType' object has no attribute 'get'
  File "telegram/ext/_application.py", line 1104, in process_update
    await coroutine
  File "telegram/ext/_conversationhandler.py", line 826, in handle_update
    new_state: object = await handler.handle_update(
  File "telegram/ext/_handler.py", line 141, in handle_update
    return await self.callback(update, context)
  File "utils/decorators.py", line 30, in command_func
    return await func(update, context, *args, **kwargs)
  File "commands/download.py", line 139, in download
    music_data = client.track_info_by_canonical_id(music_id).dict()
  File "instagrapi/mixins/track.py", line 66, in track_info_by_canonical_id
    return extract_track(track)
  File "instagrapi/extractors.py", line 460, in extract_track
    data["cover_artwork_uri"] = data.get("cover_artwork_uri") or None
adw0rd commented 1 year ago

tell me what music_id you passed?

rzashakeri commented 1 year ago

tell me what music_id you passed?

first i get id from https://www.instagram.com/reels/audio/948472866407475/ link Here ID is 948472866407475and pass to track_info_by_canonical_id

music_id = 948472866407475

adw0rd commented 1 year ago

I added another method for you because you don't have music_canonical_id

Update instagrapi:

pip install instagrapi==1.18.3

and try this:

cl.track_info_by_id(948472866407475)
rzashakeri commented 1 year ago

Thanks a lot 🙏 You really have a good package