Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection Mixin: fix last_media_pk comparison #1797

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

jsmrcaga
Copy link
Contributor

items is a list of Media, which are thus non subscriptable.

This PR fixes the access error by accessing directly to the pk property of Media.


Error for reference
    liked_posts = self.insta_client.liked_medias(
  File "/usr/local/lib/python3.10/site-packages/instagrapi/mixins/collection.py", line 94, in liked_medias
    return self.collection_medias("liked", amount, last_media_pk)
  File "/usr/local/lib/python3.10/site-packages/instagrapi/mixins/collection.py", line 188, in collection_medias
    return self.collection_medias_v1(
  File "/usr/local/lib/python3.10/site-packages/instagrapi/mixins/collection.py", line 158, in collection_medias_v1
    if last_media_pk and last_media_pk == item["media"]["pk"]:
TypeError: 'Media' object is not subscriptable

@subzeroid subzeroid merged commit ab33861 into subzeroid:master Feb 27, 2024
@subzeroid
Copy link
Owner

@jsmrcaga thank you!

@jsmrcaga
Copy link
Contributor Author

Sure @subzeroid , thank you for the amazing package!
I'll keep an eye for the release containing this fix

@jsmrcaga jsmrcaga deleted the patch-1 branch February 29, 2024 14:40
@subzeroid
Copy link
Owner

Released 2.1.1
https://pypi.org/project/instagrapi/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants