b3nab / instapy-cli Goto Github PK
View Code? Open in Web Editor NEW:sparkles: Python library and CLI to upload photo and video on Instagram. W/o a phone!
License: MIT License
:sparkles: Python library and CLI to upload photo and video on Instagram. W/o a phone!
License: MIT License
I tried to post to my Instagram and I got this:
instapy 0.0.6 | python 3.7.0
Error is >>
Unknown Server Error.
Something went bad.
I cloned the repo and tried to run the example "upload-a-video.py":
from instapy_cli import client
username = 'xxxxx'
password = 'xxxxx'
video = '../docs/video-sample-upload.mp4'
text = 'This will be the caption of your video.' + '\r\n' + 'You can also use hashtags! #hash #tag #now'
with client(username, password) as cli:
cli.upload(video, text)
But I got an error in the console that said:
Reusing settings: ig.json
Traceback (most recent call last):
File "upload-a-video.py", line 9, in <module>
cli.upload(video, text)
File "/Library/Python/2.7/site-packages/instapy_cli/cli.py", line 105, in upload
media = Media(file)
File "/Library/Python/2.7/site-packages/instapy_cli/media.py", line 29, in __init__
self.check_type()
File "/Library/Python/2.7/site-packages/instapy_cli/media.py", line 32, in check_type
self.media_ext = filetype.guess(self.media_path).extension
AttributeError: 'NoneType' object has no attribute 'extension'
Any idea what I'm doing wrong?
The trace isn't necessarily helpful, but here it is:
Traceback (most recent call last):
File "/usr/local/bin/instapy", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/instapy_cli/__main__.py", line 11, in main
print(welcome_msg)
UnicodeEncodeError: 'ascii' codec can't encode character u'\U0001f4bb' in position 0: ordinal not in range(128)
Hi, i receive this message,
checkpoint_required
and the image can't be posted ...
it will be possible to press the button "This Was Me" automatically and then post the image ?
Thanks
I wanted to use the API to upload to two different accounts and when I set it all up both of the scripts used the same ig.json file. so it would just upload to the first account since that was the one that created the JSON file. I have a workaround for it so I just rename the files at the start and end of the script but, I feel like there should be a way to change the name of the JSON file in the API or set the location of it as currently even though both scripts are in different folders the JSONfile used is in the home folder.
I'm not sure if Instapy-cli has suppor for PNG. It works flawlessly in JPG, but when I've tried to use PNG it gives me this:
instapy-cli v.0.0.4
Python version: 3.5.2
use >> instapy -u <USERNAME> -p <PASSWORD> -f <IMAGE.JPG> -t <CAPTION>
Traceback (most recent call last):
File "/home/othaner/projects/.virtualenvs/randomoji/bin/instapy", line 11, in <module>
sys.exit(main())
File "/home/othaner/projects/.virtualenvs/randomoji/lib/python3.5/site-packages/instapy_cli/__main__.py", line 45, in main
cli.upload(options.file, text)
File "/home/othaner/projects/.virtualenvs/randomoji/lib/python3.5/site-packages/instapy_cli/cli.py", line 29, in upload
self._session.configure_photo(media_id, caption)
File "/home/othaner/projects/.virtualenvs/randomoji/lib/python3.5/site-packages/instapy_cli/api/session.py", line 111, in configure_photo
raise IOError(resp_json.get('message'))
OSError: Uploaded image isn't in the right format
Is that what is happening?
This is a feature request -- the ability to follow and unfollow people, as well as list who is following you, and who you follow.
Hi, I'm testing the upload()
function, even though it returned "Done", the photo was not uploaded.
However if I added the flag story=True
, it works for the instagram story.
Describe the bug
I excute same command every day. Since today, Instagram seems to require an verification. Instapy-cli display a "challenge_required" message.
To Reproduce
instapy -u myuser -p mypassword -f https://i.imgur.com/EaWUsOs.jpg -t "Comment se faire des amis"
Expected behavior
Sending a working instagram post.
Logs
If there are any errors or exceptions, add the logs to help explain your problem.
ClientError checkpoint_challenge_required (Code: 400, Response: {"message": "challenge_required", "challenge": {"url": "https://i.instagram.com/challenge/13063477860/GhKeUCVT2D/", "api_path": "/challenge/13063477860/GhKeUCVT2D/", "hide_webview_header": true, "lock": true, "logout": false, "native_flow": true}, "status": "fail", "error_type": "checkpoint_challenge_required"})
Env (please complete the following information):
Will be possible to use a cookie instead passing user and password?
Thanks
So similar methods, for example https://stackoverflow.com/questions/18844706/how-to-post-pictures-to-instagram-using-api/26186389#26186389, result in banned accounts. What's the status of this library? Can you succesfuly post?
I was wondering if it's possible to add images and captions from a csv file at specific daily intervals
Describe the bug
After the command pip install instapy-cli an error occurs:
Collecting instagram-private-api-extensions==0.3.8 (from instapy-cli)
ERROR: Could not find a version that satisfies the requirement instagram-private-api-extensions==0.3.8 (from instapy-cli) (from versions: none)
ERROR: No matching distribution found for instagram-private-api-extensions==0.3.8 (from instapy-cli)
To Reproduce
pip install instapy-cli
pip install instapy-cli
Expected behavior
Was expected to install instapy-cli
Logs
Collecting instagram-private-api-extensions==0.3.8 (from instapy-cli)
ERROR: Could not find a version that satisfies the requirement instagram-private-api-extensions==0.3.8 (from instapy-cli) (from versions: none)
ERROR: No matching distribution found for instagram-private-api-extensions==0.3.8 (from instapy-cli)
Env (please complete the following information):
-WIndows
Hi, I want to catch all exceptions of your library.
I'm trying with:
except Exception as e:
but doesn't works. If I'm not wrong, there is no example in your repository.
What can I use?
Thank you and sorry for bothering you in these days.
When script attempts to login it raises this error. This occurs because instagram is trying to prevent suspicious activity and requires code which was sent on registered email.
I think there are need an additional step on login or first login should be interactive when user able to input code from email. Also user agent must not changed between logins to tell instagram that device already verified.
Better solution is to save session to file and use it for further actions.
Hey there,
im quite new to Python :). I really love your library.
But somehow when Im uploading like this:
contenttext = 'welcome to our Instagram'
subprocess.call('instapy -u {0} -p {1} -f {2} -t {3}'.format(accname1, pw1, path, str(contenttext)))
the program just uploads the text: "welcome" and nothing else :( it somehow misses everything beyond the blank space.
What am I doing wrong?
With the latest version of the library (released just a a couple of hours ago), I'm trying to upload images in my story, but I need to preserve order, so I'm trying with time.sleep(1), but it doesn't works, order is almost random.
This is the code:
with client(config.instagram_username, config.instagram_password) as cli:
for i in range(0, len(image_files)):
cli.upload(image_files[i], story=True)
time.sleep(1)
What can I try? Python 3.7.1
Thank you for the lib. It´s amazing.
I had a problem with the text. For example:
instapy -u USR -p PSW -f FILE/LINK -t 'TEXT CAPTION'
I just post"TEXT". I can´t get the other words.
hi there is there any way I can have Instagram URL of Uploaded pic ?
Hi,
is there any chance to get the possibility to set the location when uploading a photo?
The best would be to extract it via metadata of the photo ;)
Thanks
I had trouble uploading images and I realized that the images should have an aspect ratio of 1:1 (square). IMO it would be good to include this in the readme.
Hi, I'm trying to install de package instapy-cli, however the error occured:
(base) PS C:\Users\web> pip install instapy-cli Collecting instapy-cli Using cached https://files.pythonhosted.org/packages/ac/32/4dd2ac6c4e48bfba9bb387b6d4049b039865596adb2b99aca1058f5938e5/instapy_cli-0.0.12-py2.py3-none-any.whl Collecting filetype==1.0.5 (from instapy-cli) Using cached https://files.pythonhosted.org/packages/1c/78/047cf0f371f8faafab05b5062f902d4bedd945d436544b30db692622ab84/filetype-1.0.5-py2.py3-none-any.whl Requirement already satisfied: requests>=2 in c:\programdata\anaconda3\lib\site-packages (from instapy-cli) (2.21.0) Collecting instagram-private-api-extensions==0.3.8 (from instapy-cli) Using cached https://files.pythonhosted.org/packages/fb/3a/f9e594ab71d17f2deb59ab94c901914bc69a3b229b496c4cd70c5e89d6de/instagram_private_api_extensions-0.3.8-py3-none-any.whl Requirement already satisfied: instagram-private-api==1.6.0 in c:\programdata\anaconda3\lib\site-packages (from instapy-cli) (1.6.0.0) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\programdata\anaconda3\lib\site-packages (from requests>=2->instapy-cli) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\lib\site-packages (from requests>=2->instapy-cli) (2019.3.9) Requirement already satisfied: idna<2.9,>=2.5 in c:\programdata\anaconda3\lib\site-packages (from requests>=2->instapy-cli) (2.8) Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\programdata\anaconda3\lib\site-packages (from requests>=2->instapy-cli) (1.24.1) Requirement already satisfied: Pillow>=4.0.0 in c:\programdata\anaconda3\lib\site-packages (from instagram-private-api-extensions==0.3.8->instapy-cli) (5.4.1) Collecting moviepy==0.2.3.2 (from instagram-private-api-extensions==0.3.8->instapy-cli) Using cached https://files.pythonhosted.org/packages/e4/1f/fb4b8d9397f7952fcb594cb5df3061f00debae7ea92b3be9881c18b905ab/moviepy-0.2.3.2-py2.py3-none-any.whl Requirement already satisfied: tqdm==4.11.2 in c:\programdata\anaconda3\lib\site-packages (from moviepy==0.2.3.2->instagram-private-api-extensions==0.3.8->instapy-cli) (4.11.2) Collecting imageio==2.1.2 (from moviepy==0.2.3.2->instagram-private-api-extensions==0.3.8->instapy-cli) Requirement already satisfied: decorator==4.0.11 in c:\programdata\anaconda3\lib\site-packages (from moviepy==0.2.3.2->instagram-private-api-extensions==0.3.8->instapy-cli) (4.0.11) Requirement already satisfied: numpy in c:\programdata\anaconda3\lib\site-packages (from moviepy==0.2.3.2->instagram-private-api-extensions==0.3.8->instapy-cli) (1.16.2) Installing collected packages: filetype, imageio, moviepy, instagram-private-api-extensions, instapy-cli Found existing installation: imageio 2.5.0 Cannot uninstall 'imageio'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Someone can help me? I tried to uninstall manually the imageio package, but the error still occurs.
Whenever I upload an image, sometimes the caption doesn't upload with the image. Meaning, there is no caption on the image uploaded.
Any help would be appreciated.
I used the upload-a-photo.py exmaple (but with my infos) but i get this error mesage and i have no idea what it means or how to fix it.
Here's the error message :
[IG] not found cookie/cookie_file >> login as default
ClientError URLError <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)> (Code: 0, Response: )
And here's my code (with my info hashtagged) :
from instapy_cli import client
username = '#########'
password = '########'
image = 'downloads/what.png'
text = 'My profile pic' + '\r\n' + 'You can use hashtags! #hash #tag #now'
with client(username, password) as cli:
cli.upload(image, text)
I'm with python 3.7 on macOS with the lastest version on instapy (downloaded this morning with pip install)
Hi, is it possible to use Oauth protocol instead of raw username and password? I think it would make a even more robust API.
I'm actually having a problem when uploading stories
I followed the documentation and wrote
instapy -u USR -p PWD -f pyArt.jpeg -s 'Python is an Art.'
But it Shows.
Traceback (most recent call last):
File "/usr/local/bin/instapy", line 10, in <module>
sys.exit(main())
File "/home/johnson/.local/lib/python3.7/site-packages/instapy_cli/__main__.py", line 47, in main
cli.upload(options.file, text, story)
File "/home/johnson/.local/lib/python3.7/site-packages/instapy_cli/cli.py", line 164, in upload
raise IOError("Unable to upload.")
OSError: Unable to upload.
Env
Hi, I'm trying to upload an image to a story whose resolution is 1080x1920 which should be the best resolution for IG Stories, as stated in a lot of blog, such as in this extract:
Instagram story dimensions are 1080px wide by 1920px tall. Portrait photos and videos taken on your smartphone will be 1080 pixels wide by 1920 pixels in height, while other photos and videos should be reformatted to fit these dimensions. This is also known as a 9:16 aspect ratio.
I get the following error:
warnings.warn('This endpoint has not been fully tested.', UserWarning)
Error is >>
Incompatible reel aspect ratio.Something went bad.
Please retry or send an issue on https://github.com/b3nab/instapy-cli
Hi, thanks for setting up this new fork. This is to be intended as a suggestion and not an issue.
Reflecting on the name, I can see there is an existing instapy project with quite a lot of stars. I think this being a fork from pynstagran and being named so close to instapy can create some confusion.
My suggestion is to find a name that is closer to the project is forked from, or a completely new one.
Looking forward to contribute to this.
Hey, first of all thanks for awesome script.
I try to upload Instagram post from Ubuntu server, but I get "OSError: checkpoint_required" error.
I manage to bypass this problem on my local system with this explanation - https://github.com/b3nab/instapy-cli/wiki/Errors , but can't do the same on external server. Any ideas how I could solve my problem ? Thanks.
Is your feature request related to a problem? Please describe.
By creating the ig.json
wherever the script is run, instapy-cli
is polluting the user’s system (likely the home) and not taking advantage of the config if it already exists in another directory.
Describe the solution you'd like
The config file should be stored in a fixed location, either following the XDG Base Directory specification, or at the very least in the fixed ~/.config/instapy-ci/ig.json
.
To support for multiple cookies/logins (I have no use for, but it seems to be one of the goals of the project), there could be a command line flag (--cookie
, -c
) that takes a path as the argument to save/read from. Even in that case, there should be a default location.
Describe alternatives you've considered
My current workaround is to wrap the tool in a script, and cd
to a fixed directory before running the tool:
config_dir="${HOME}/.config/instapy-cli"
[[ -d "${config_dir}" ]] || mkdir -p "${config_dir}"
cd "${config_dir}" || exit 1
Additional context
N/A
i get command not found on a antergos machine and a raspberry pi.
greetings nikk
Is your feature request related to a problem? Please describe.
No is not related to a problem.
Describe the solution you'd like
Allow upload of more than one photo at the same post
Describe alternatives you've considered
Like stories example th feature would allow the upload of more than one photo per post.
By creating the ig.json
wherever the script is run, instapy-cli
is polluting the user’s system (likely the home) and not taking advantage of the config if it already exists in another directory.
The config file should be stored in a fixed location, either following the XDG Base Directory specification, or at the very least in the fixed ~/.config/instapy-ci/ig.json
.
Whenver I try to use this tool, it gives me "OSError: Uploaded image isn't in the right format" even though the picture is a .jpg file and the resolution is 1080px x 1080px, any ideas what is going wrong?
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Actually I want to know is there any way to add a story/a story with tag using instapy-cli?
However I appreciate your great work. It works like a charm.
Hey I experienced the following problem.
I upload the picture with hashtag H from account X. Account Y doesnt follow account X and cant see the uploaded picture from under hashtag H. However when its uploaded using Ramme, picture is visible for account Y under hashtag H.
Hi,
the caption stopped posting with the image at exactly midnight today. It only posts the images. Im crating a new client instance for every upload so that cant be the problem. Script was unchanged for days. i'll be testing tomorrow to see whats wrong but i thought i might give u a early heads up if the api changed or something like that. Thanks for creating this tool
After the image is uploaded to instagram it gets deleted from the local storage of computer.
How do i stop it from happening.
In media.py of this repo i found this
def removeMedia(self):
os.remove(self.pathFile)
Help would be appreciated
After a few weeks of good working I'm getting this error.
Traceback (most recent call last):
File "/.virtualenvs/randomoji/bin/instapy", line 11, in <module>
sys.exit(main())
File "/.virtualenvs/randomoji/lib/python3.5/site-packages/instapy_cli/__main__.py", line 43, in main
with client(options.username, password) as cli:
File "/.virtualenvs/randomoji/lib/python3.5/site-packages/instapy_cli/cli.py", line 15, in __init__
self._session.login(username, password)
File "/.virtualenvs/randomoji/lib/python3.5/site-packages/instapy_cli/api/session.py", line 66, in login
raise IOError(resp_json.get('message'))
OSError: Sorry, there was a problem with your request.
I've login in the account and everything seems normal (there's no checkpoint or something). Any ideas?
Following the install instructions:
pip install instapy-cli
I got
Could not find a version that satisfies the requirement instagram-private-api-extensions==0.3.8 (from instapy-cli) (from versions: )
No matching distribution found for instagram-private-api-extensions==0.3.8 (from instapy-cli)
So I went to instagram-private-api-extensions
’s page and followed their instructions:
pip install git+https://[email protected]/ping/[email protected]
I had to do the same with instagram-private-api
, and then instapy-cli
installed fine. However, those two packages should have been installed automatically.
Python 3.7.2
on macOS 10.14.4
.
Can we use a Proxy to do the requests ?
Not sure this is a bug, but I had trouble uploading some pics today, so i updated the project via pip,
now i get this "NameError: global name 'instapy_cli' is not defined" ; not sure what to do!
Hii
I don't have 2FA enabled, no . alerts when I login to the website however when I try to push a image I get this:
instapy 0.0.6 | python 2.7.13
Traceback (most recent call last):
File "/usr/local/bin/instapy", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/instapy_cli/main.py", line 48, in main
with client(options.username, password) as cli:
File "/usr/local/lib/python2.7/dist-packages/instapy_cli/cli.py", line 9, in init
self._session.login(username, password)
File "/usr/local/lib/python2.7/dist-packages/instapy_cli/api/session.py", line 66, in login
raise IOError(resp_json.get('message'))
IOError: Sorry, there was a problem with your request.
Am I missing something?
Hi!
This program is very usefull, thanks for sharing!
Would it be possible to add the options like in the Instagram-app for automaticly share a new Instagram-post to Facebook/Twitter/Tumblr?
Thanks,
Johan.
url = 'https://i.imgur.com/9wGJWa0.png'
Hey There! :)
installed the v.0.0.3 via pip, and i get this error now:
instapy-cli v.0.0.3
Python version: 2.7.14
use >> instapy -u -p -f <IMAGE.JPG> -t
Traceback (most recent call last):
File "/usr/local/bin/instapy", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/instapy_cli/main.py", line 36, in main
with client(options.username, password) as cli:
File "/usr/local/lib/python2.7/dist-packages/instapy_cli/cli.py", line 9, in init
self._session.login(username, password)
File "/usr/local/lib/python2.7/dist-packages/instapy_cli/api/session.py", line 66, in login
raise IOError(resp_json.get('message'))
IOError: checkpoint_required
using the app to upload a picture via:
instapy -u username -p pass -f filename -t "your text"
thanks for your work!
I'm testing the library. Following the example found at examples/upload-a-photo.py, I use '\r\n'
to mark a breakline in the caption, but it's not working. I have tested \n
too. Is it a normal behaviour? How can I insert a breakline in the caption?
Comments on the uploaded photos say that they are "limited"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.