From 9c432027b58cde178fee9f058053d9ba319f436c Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Fri, 23 Dec 2022 02:27:11 +0000 Subject: [PATCH] instagram.android: fix missing id --- my/instagram/android.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/my/instagram/android.py b/my/instagram/android.py index a34660c..8e44ebe 100644 --- a/my/instagram/android.py +++ b/my/instagram/android.py @@ -119,15 +119,17 @@ def _entities() -> Iterator[Res[Union[User, _Message]]]: # todo use TypedDict? for f in inputs(): with sqlite_connect_immutable(f) as db: - for (self_uid, thread_json) in select(('user_id', 'thread_info'), 'FROM threads', db=db): j = json.loads(thread_json) # todo in principle should leave the thread attached to the message? # since thread is a group of users? # inviter usually contains our own user for r in [j['inviter'], *j['recipients']]: + # id disappeared and seems that pk_id is in use now (around december 2022) + uid = r.get('id') or r.get('pk_id') + assert uid is not None yield User( - id=str(r['id']), # for some reason it's int in the db + id=str(uid), # for some reason it's int in the db full_name=r['full_name'], username=r['username'], )