Comments (10)
@b3nab i have the solution, the issue's origin is actually the filetype library and specifically this line at media.py
self.media_ext = filetype.guess(self.media_path).extension
filetype is returning None on some videos so to fix it you can use Magic instead of filetype
PyPi: https://pypi.org/project/python-magic-bin/0.4.14/ or Pip: pip install python-magic-bin
so now in the media.py
first : import magic
then change the check_type function to this:
`def check_type(self):
self.media_ext = magic.from_file(self.media_path,mime=True)
self.media_ext= self.media_ext.split('/')[1]`
from instapy-cli.
please, add relevant informations such as python and instapy-cli version
Also, I suggest you to update to latest release of instapy-cli 0.0.10
and re-try.
from instapy-cli.
Hello. I've got the same sort of error on .mp4 file in ubuntu. Pictures are send successfully without errors.
instapy-cli 0.0.10 | python 3.5.2
Reusing settings: User_ig.json
Traceback (most recent call last):
File "/usr/local/bin/instapy", line 10, in
sys.exit(main())
File "/home/digital/.local/lib/python3.5/site-packages/instapy_cli/main.py", line 44, in main
cli.upload(options.file, text, story)
File "/home/digital/.local/lib/python3.5/site-packages/instapy_cli/cli.py", line 109, in upload
media = Media(file)
File "/home/digital/.local/lib/python3.5/site-packages/instapy_cli/media.py", line 29, in init
self.check_type()
File "/home/digital/.local/lib/python3.5/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'_
from instapy-cli.
Hi,
I dont know if this issues is resolved or not.
I just got the same issues
python ver : 3.6.8 | instapy-cli 0.0.12
Traceback (most recent call last):
File "c:\users\oce\anaconda3\envs\insta\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\users\oce\anaconda3\envs\insta\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\oce\Anaconda3\envs\insta\Scripts\instapy.exe_main.py", line 9, in
File "c:\users\oce\anaconda3\envs\insta\lib\site-packages\instapy_cli_main.py", line 44, in main
cli.upload(options.file, text, story)
File "c:\users\oce\anaconda3\envs\insta\lib\site-packages\instapy_cli\cli.py", line 116, in upload
media = Media(file)
File "c:\users\oce\anaconda3\envs\insta\lib\site-packages\instapy_cli\media.py", line 29, in init
self.check_type()
File "c:\users\oce\anaconda3\envs\insta\lib\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'
Help would greatly appreciated
Thanks
from instapy-cli.
This is duo to the missing sanity check for the filetype. Somehow the lib filetype is having problems with some mp4 and can't guess the right type.
from instapy-cli.
Can you provide a mp4 video example that filetype failed to identify?
from instapy-cli.
Of course, this one, for example:
File.mp4
from instapy-cli.
from instapy-cli.
@b3nab Please review the changes if possible.
This is an issue which is also happening in my use case of this library.
from instapy-cli.
Hey guys I have been having the same issue my code was:
from
instapy_cli import client
username = 'testing211714'
password = '****'
image = 'posts/keenan.png'
text = 'This will be the caption of your photo.' + '\r\n' + 'You can also use hashtags! #hash #tag #now'
with client(username, password) as cli:
cli.upload(image, text)`
But recieved the error:
(env) Ryans-MacBook-Pro:InstaAutomaterFirstTry ryankeenan$ python app.py
[IG] not found cookie/cookie_file >> login as default
Error parsing error response: Expecting value: line 1 column 1 (char 0)
Error is >>
Bad Request
Something went bad.
Please retry or send an issue on https://github.com/b3nab/instapy-cli
Traceback (most recent call last):
File "app.py", line 9, in
cli.upload(image, text)
File "/Users/ryankeenan/Desktop/git/InstaAutomaterFirstTry/env/lib/python3.7/site-packages/instapy_cli/cli.py", line 153, in upload
raise IOError("Unable to upload.")
OSError: Unable to upload.
I followed @salahar9 advice and imported magic at media.py but the error just changed to:
(env) Ryans-MacBook-Pro:InstaAutomaterFirstTry ryankeenan$ python app.py
[IG] not found cookie/cookie_file >> login as default
Error parsing error response: Expecting value: line 1 column 1 (char 0)
Error is >>
Bad Request
Something went bad.
Please retry or send an issue on https://github.com/b3nab/instapy-cli
Traceback (most recent call last):
File "app.py", line 10, in
cli.upload(image, text)
File "/Users/ryankeenan/Desktop/git/InstaAutomaterFirstTry/env/lib/python3.7/site-packages/instapy_cli/cli.py", line 153, in upload
raise IOError("Unable to upload.")
OSError: Unable to upload.
Does anyone see where I went wrong??
from instapy-cli.
Related Issues (20)
- Unable to upload HOT 1
- simple jpg upload from CLI or Python script won't work... [BUG] HOT 2
- [BUG] cannot upload an image HOT 3
- [BUG] can't upload image HOT 1
- Can't upload image[. BUG] HOT 9
- [BUG] Getting Something went wrong while uploading photo HOT 2
- [BUG] HOT 5
- How to post a photo album?[F+] HOT 1
- I can't upload photos HOT 9
- can i post instagram reels with instapy? [F+] HOT 1
- [BUG]"error_type": "checkpoint_challenge_required"
- [BUG] HOT 2
- Issue: Duration is too short error.
- [BUG] Upload function Says, Error parsing error response: Expecting value: line 1 column 1 (char 0) HOT 2
- [BUG] Unknown error (Something went bad)
- [BUG] THIS DOES NOT WORK
- [BUG] Error parsing error response: Expecting value: line 1 column 1 (char 0) HOT 4
- Error is >> Bad Request HOT 7
- ModuleNotFoundError: No module named 'instapy_cli' HOT 4
- Unable to upload photo on insta. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instapy-cli.