Closed 69haha420 closed 1 year ago
@zmotan cannot reproduce
from instagrapi import Client
from instagrapi.types import Location, Usertag
cl = Client(...)
cl.login(...)
media = cl.media_info(cl.media_pk_from_url("https://www.instagram.com/p/B8RaCaPAEtT/"))
photo = cl.photo_download_by_url(media.thumbnail_url)
user = cl.user_info(cl.user_id)
cl.photo_upload(path=photo, location=Location(name="zmotan.com", lat=46.057661, lng=14.505980), usertags=[Usertag(user=user, x=0.5, y=0.5)], caption="TEST MSG")
Media(pk='2847468023696840083', id='2847468023696840083_29817608135', code='CeEPRS9u9WT', taken_at=datetime.datetime(2022, 5, 27, 15, 17, 41, tzinfo=datetime.timezone.utc), media_type=1, product_type='feed', thumbnail_url=HttpUrl('https://scontent-msp1-1.cdninstagram.com/v/t51.2885-15/284591628_308939281445365_8821881272139351405_n.jpg?se=7&stp=dst-jpg_e35&_nc_ht=scontent-msp1-1.cdninstagram.com&_nc_cat=101&_nc_ohc=Yw_k35yOP_UAX_-rIka&edm=ACqnv0EBAAAA&ccb=7-5&ig_cache_key=Mjg0NzQ2ODAyMzY5Njg0MDA4Mw%3D%3D.2-ccb7-5&oh=00_AT93ekGbfPrk-LFXtjCfdsl3uJrJbSAgaYZZgOSh_9tubg&oe=6297E455&_nc_sid=9ec724', scheme='https', host='scontent-msp1-1.cdninstagram.com', tld='com', host_type='domain', port='443', path='/v/t51.2885-15/284591628_308939281445365_8821881272139351405_n.jpg', query='se=7&stp=dst-jpg_e35&_nc_ht=scontent-msp1-1.cdninstagram.com&_nc_cat=101&_nc_ohc=Yw_k35yOP_UAX_-rIka&edm=ACqnv0EBAAAA&ccb=7-5&ig_cache_key=Mjg0NzQ2ODAyMzY5Njg0MDA4Mw%3D%3D.2-ccb7-5&oh=00_AT93ekGbfPrk-LFXtjCfdsl3uJrJbSAgaYZZgOSh_9tubg&oe=6297E455&_nc_sid=9ec724'), location=Location(pk=213606897, name='Ljubljana, Slovenia', phone='', website='', category='', hours={}, address=None, city=None, zip=None, lng=14.506, lat=46.0576, external_id=111980668819694, external_id_source='facebook_places'), user=UserShort(pk='29817608135', username='adw0rd_', full_name='Mikhail Andreev', profile_pic_url=HttpUrl('https://scontent-msp1-1.cdninstagram.com/v/t51.2885-19/266338300_211602184377529_159610427246423029_n.jpg?stp=dst-jpg_s150x150&_nc_ht=scontent-msp1-1.cdninstagram.com&_nc_cat=101&_nc_ohc=R5TltjsL1ksAX99THWX&edm=ACqnv0EBAAAA&ccb=7-5&oh=00_AT9A85sf2ze3uEs4BkIqX0Vpob_Tc905zFnWLfvUWXexqQ&oe=62986B83&_nc_sid=9ec724', scheme='https', host='scontent-msp1-1.cdninstagram.com', tld='com', host_type='domain', port='443', path='/v/t51.2885-19/266338300_211602184377529_159610427246423029_n.jpg', query='stp=dst-jpg_s150x150&_nc_ht=scontent-msp1-1.cdninstagram.com&_nc_cat=101&_nc_ohc=R5TltjsL1ksAX99THWX&edm=ACqnv0EBAAAA&ccb=7-5&oh=00_AT9A85sf2ze3uEs4BkIqX0Vpob_Tc905zFnWLfvUWXexqQ&oe=62986B83&_nc_sid=9ec724'), profile_pic_url_hd=None, is_private=False, stories=[]), comment_count=0, like_count=0, has_liked=False, caption_text='TEST MSG', accessibility_caption=None, usertags=[Usertag(user=UserShort(pk='29817608135', username='adw0rd_', full_name='Mikhail Andreev', profile_pic_url=HttpUrl('https://scontent-msp1-1.cdninstagram.com/v/t51.2885-19/266338300_211602184377529_159610427246423029_n.jpg?stp=dst-jpg_s150x150&_nc_ht=scontent-msp1-1.cdninstagram.com&_nc_cat=101&_nc_ohc=R5TltjsL1ksAX99THWX&edm=ACqnv0EBAAAA&ccb=7-5&oh=00_AT9A85sf2ze3uEs4BkIqX0Vpob_Tc905zFnWLfvUWXexqQ&oe=62986B83&_nc_sid=9ec724', scheme='https', host='scontent-msp1-1.cdninstagram.com', tld='com', host_type='domain', port='443', path='/v/t51.2885-19/266338300_211602184377529_159610427246423029_n.jpg', query='stp=dst-jpg_s150x150&_nc_ht=scontent-msp1-1.cdninstagram.com&_nc_cat=101&_nc_ohc=R5TltjsL1ksAX99THWX&edm=ACqnv0EBAAAA&ccb=7-5&oh=00_AT9A85sf2ze3uEs4BkIqX0Vpob_Tc905zFnWLfvUWXexqQ&oe=62986B83&_nc_sid=9ec724'), profile_pic_url_hd=None, is_private=False, stories=[]), x=0.5, y=0.5)], video_url=None, view_count=0, video_duration=0.0, title='', resources=[], clips_metadata={})
Thank you for your time and answer, I will do few tests in next few days and will post an update.
Best regards, Z
From my experience, if your photo is not a JPEG or WEBP file, it will not work, thus might trigger such error.
Make sure to convert any .png to .jpg first ;)
From my experience, if your photo is not a JPEG or WEBP file, it will not work, thus might trigger such error.
Make sure to convert any .png to .jpg first ;)
Thank you for clearing that out, I believe this might be the root of the problem.
Cheers 🍻
Describe the bug When I try to post on Instagram I get some wierd error I didn't find in documentation. It worked the first time and now its not working anymore even when I try to post it with an example code. EDIT: typo
To Reproduce
Traceback
Expected behavior Should upload the photo from attachment as a post.
Screenshots
Desktop (please complete the following information):
Thanks in advance!
Best regards, zmotan