Danie1 / threads-api

Unofficial Python API for Meta's Threads App
https://pypi.org/project/threads-api/
MIT License
108 stars 15 forks source link

Post with Image, Image size limitation (upd: mime types problem, not size) #42

Closed keith284487 closed 11 months ago

keith284487 commented 11 months ago

Hello,

Thx for the great work. Works very stable. I have found an issue. When I use an image (external url) over 1mb, it fails.

Is it an API limitation or sort of a bug?

Danie1 commented 11 months ago

Hi, first of all, thank you so much! I appreciate to hear it :)

It may be an API limitation, although 1mb sounds a bit low.

I suggest you set the LOG_LEVEL environment variable to DEBUG, and re-run your script. Sometimes the http responses hint as to why it had failed. Once you have this information / any additional data I can also take a look.

keith284487 commented 11 months ago

Danie1, thank you for the answer. It's not about size, but a mime type. Should be PNG, but identified as JPEG. I am checking further.

keith284487 commented 11 months ago

Look. I am uploading external image as URL. Somehow content_type is "binary/octet-stream" and I end up with "jpeg".

Also when you use on Insta image url, it gives you no content type as well. file_name = url.split("/")[-1]

So i have deleted the conditional statement and changed url to image_url. But I don't know how everything should work and maybe it's not even a bug.

image

keith284487 commented 11 months ago

I just made it temporary like that. image

vnetb commented 11 months ago

see. https://github.com/junhoyeo/threads-api/issues/82

Instead of configure_text_post_app_feed, they use configure_text_post_app_sidecar

Danie1 commented 11 months ago

Hey @keith284487 , thanks for contributing by opening this issue and looking into this further. I am pushing a fix to this in this PR: https://github.com/Danie1/threads-api/pull/52

Thanks @vnetb for referencing this. It looks like it's possible to upload more than 1 image to a post using this method. I will look into it for the upcoming versions.

I am able to fix these issues thanks to folks like you guys, who take interest in the project and contribute their time too :)

Danie1 commented 11 months ago

I am closing this, since it was fixed in https://github.com/Danie1/threads-api/releases/tag/v1.1.13.

Please open a new issue if another one appears.

Regarding @vnetb 's idea of multiple-images, I will try to address this in upcoming versions. You are more than welcome to open an issue for this 😃