Comments (4)
Yes, this would be a nice feature.
I was wondering whether there was some kind of standard or convention for how exit codes are assigned in typical unix applications, but it seems there is none except of zero being a success status and non-zero an error status. Apart of that, all tools seem to follow their arbitrary mapping of error types to exit codes.
Instaloader already distinguishes many types of errors with different exception types, it would be great to map those into return codes for the cli application. We could somehow resemble the exception tree, combined with some semantical/logical grouping of error types into the error code, e.g. by assigning a few bits to the group and the other bits to a finer granulation, as this might simplify the parsing of the exit status. So we would both have a fine granularity without making the feature less useful I think.
I could imagine something like
code |
Meaning |
---|---|
0x01 | InvalidArgumentException, invalid command line arguments, --load-cookies without the library, and other failures before anything was attempted (which are currently returned with a simply SystemExit before an Instaloader instance is created) |
0x10 | Other connection error |
0x11 | Query returned "not found" |
0x12 | Too many requests |
0x21 | Query returned "bad request" |
0x22 | Query returned "forbidden" |
0x23 | Profile not exists |
0x24 | Private profile not followed |
0x25 | Login required |
0x26 | IPhoneSupportDisabledException |
0x41 | Two factor auth required |
0x42 | Bad credentials |
0x81 | User aborted (--abort-on ) |
0x82 | User aborted (SIGINT / control+c) |
So this would imply a grouping of
code & 0xf0 |
Meaning of group |
---|---|
0x00 | Invalid invocation, before anything was attempted |
0x10 | Invocation was correct, however Instaloader failed to download |
0x20 | Download of the target impossible with the given invocation |
0x40 | Login error |
0x80 | User aborted |
This is close to the grouping given by the exception tree, which itself was built on the way of how they must be handled internally.
However, this is only a suggestion after brief consideration. I do not want to rule out the possibility that there might be a more sensible or appropriate mapping.
from instaloader.
I think too many exit codes would actually add too much complexity for little benefit. If the user needs that much detail, they can use instaloader as a module and catch the actual exceptions.
[Moreover, retrofitting the exit codes in the existing code is not trivial - and the more different codes there are, the more work is necessary.]
But in addition to the general categories I had identified, some of the ones you listed can be useful:
- Too many requests - I'd say this one deserves its own error code. However, from what I remember, if a 429 is received, the program just waits and then retries, indefinitely. It does not abort the program, unless
--abort-on
is used. - Login required - Probably useful
- Profile does not exists / is private - Could be useful. Would be more a warning than an error, since just one of many profiles could have failed. On the on other hand, some users occasionally make their profile private (or disable them) temporarily, and I'm not sure I need to mark a instaloader run as 'failed' just because of that.
Basically your idea of groups is quite similar to my proposal, but I'm not really convinced that the level of detail provided by the lower byte is really useful. And from what I remember, some errors you listed ("bad request", "forbidden", etc) don't cause the program to terminate, just to retry or skip that item.
from instaloader.
Related Issues (20)
- Location ID syntax fails with HTTP code 201
- ConnectionException: JSON Query to graphql/query: HTTP error code 401. HOT 1
- Multiple post owners HOT 1
- User agent mismatch, changed many useragents but to no avail, still the same error. HOT 5
- Get hashtag #vegan: JSON Query to explore/tags/vegan/: 404 Not Found HOT 4
- Add more return fields on 'get_sidecar_nodes' method HOT 1
- Error downloading IGTV files
- The procedure entry point PssQuerySnapshot could not be located in the dynamic link library KERNEL32.dll. HOT 2
- How to download 615_import_firefox_session.py
- Is it possible to download a instagram reel with audio, using instaloader? HOT 2
- Trying to load_session_from_file, but it's looking in /var/folders/...
- Unable to download videos posted by users on Reels. HOT 1
- 401 error using post.get_comments(). HOT 1
- posts views not accurate HOT 1
- Fatal error: Login error: "fail" status, message "CSRF token missing or incorrect". HOT 1
- Top comments often missing
- Trying to download comments of a public post, do I need to login first? HOT 2
- How to download Ig story only using cmd command? download more than 1500 posts? HOT 2
- ..
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 instaloader.