subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 685 forks source link

With public or shared image url(http) photo_upload not working #343

Closed parth23 closed 3 years ago

parth23 commented 3 years ago

Describe the bug I am trying to upload photo using http(public url) but it's throwing error: OSError: [Errno 22] Invalid argument: 'https:\i.pinimg.com\originals\32\c6\8b\32c68bf4a443232286d91b1cc66f3822.jpg'

To Reproduce Use any public image url to upload

Expected behavior local image upload is working fine but the issue is with the public image url

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information):

adw0rd commented 3 years ago

You need to pass the path to the file, not the URL

image

https://adw0rd.github.io/instagrapi/usage-guide/media.html

parth23 commented 3 years ago

@adw0rd so you mean I can't upload image with url? Could you please provide any solution for that then?

parth23 commented 3 years ago

You need to pass the path to the file, not the URL

image

https://adw0rd.github.io/instagrapi/usage-guide/media.html

@adw0rd so you mean I can't upload image with url? Could you please provide any solution for that then?

adw0rd commented 3 years ago

@parth23 you can download the file and upload it image https://adw0rd.github.io/instagrapi/usage-guide/media.html

adw0rd commented 3 years ago

@parth23 If you are downloading from some other site, you can use the httpx, requests or urllib library to download the file, read their documentation

parth23 commented 3 years ago

@parth23 If you are downloading from some other site, you can use the httpx, requests or urllib library to download the file, read their documentation

@adw0rd Actually I have a list of URLs that are stored in DB and I am planning to schedule it. I don't want to download and then upload it. Facebook Graph API is providing such facility to upload photos using URL path. I am using instagrapi is because of album_upload. See if you can find out any solution in your existing code that will be more helpful

adw0rd commented 3 years ago

@parth23 Instagram does not allow to download content by URL, it requires the transfer of the file content, in any case, you will have to download the content to upload it to the Instagram server