InstAPI
Provides abstractions over the Instagram Basic Display API to retrieve tokens and gather user's profile information and media.
Example usage
use ;
let secrets = Secrets ;
// Forward the user to the authorization page and interactively request a code.
let code = request_code?;
// Exchange the authorization code for a short-lived token.
let token = new?;
// Link the token with profile.
let profile = new;
// Retrieve the user profile information and print username.
println!;
Modules description
-
The
auth
module implements authorization related stuff: secrets and tokens. TheSecrets
structure used to store private information of your Instagram application. Tokens can be of two types: short-lived and long-lived. The first one is only available for 1 hour after retrieving and can't be refreshed. A long-lived token is produced by exchanging a short-lived token and it available for 60 days (or 90 days for private accounts) after retrieving. -
The
user
module provides methods to retrieve user's profile information and media, including albums content. Each profile is linked to a token.
Instafetcher
An example utility that provides command-line interface for the library.
To build this tool you need to set INSTAGRAM_APP_ID
, INSTAGRAM_APP_SECRET
and INSTAGRAM_OAUTH_URI
environment variable with the corresponding values. To
perform authorization use --log-in
option, that will store a long-lived token
in the system's configuration directory. After that you can use the following
main options:
--info
. Retrieve and display the basic profile information.--media
. Download all media files to the given directory. File names have the following format:<owner's username>_<media ID>_<publish date>
. For each album will be created a subdirectory. To exclude albums use--no-albums
option.