subzeroid / instagrapi

šŸ”„ The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.31k stars 681 forks source link

[BUG] #1788

Open keyvanme opened 8 months ago

keyvanme commented 8 months ago

i have a problem with client.direct_send(text='texts',user_ids=[userid]) i get this error:

TypeError Traceback (most recent call last) Cell In[10], line 1 ----> 1 client.direct_send(text='texts',user_ids=[userid])

File C:\ProgramData\anaconda3\Lib\site-packages\instagrapi\mixins\direct.py:459, in DirectMixin.direct_send(self, text, user_ids, thread_ids, send_attribute) 453 kwargs["recipient_users"] = dumps([[int(uid) for uid in user_ids]]) 454 result = self.private_request( 455 f"direct_v2/threads/broadcast/{method}/", 456 data=self.with_default_data(kwargs), 457 with_signature=False, 458 ) --> 459 return extract_direct_message(result["payload"])

File C:\ProgramData\anaconda3\Lib\site-packages\instagrapi\extractors.py:335, in extract_direct_message(data) 332 if xma_media_share: 333 data["xma_share"] = extract_media_v1_xma(xma_media_share[0]) --> 335 data['timestamp'] = datetime.datetime.fromtimestamp(data['timestamp'] // 1_000_000) 336 data['user_id'] = str(data['user_id']) 338 return DirectMessage(**data)

TypeError: unsupported operand type(s) for //: 'str' and 'int'

pooyazamanian commented 8 months ago

I have exactly this eroor in my project Are you get solution for this issue?

birdhouses commented 8 months ago

Wrote a fix for this https://github.com/subzeroid/instagrapi/pull/1821