Elixir Library for Accessing Instagram Public Data without API Key
If available in Hex, the package can be installed
by adding insta_data
to your list of dependencies in mix.exs
:
def deps do
[
{:insta_data, "~> 0.1.0"}
]
end
alias InstaData.Instagram
sync:
Instagram.User.get("instagram")
async:
Instagram.User.get("instagram",
fn ({_username, %Instagram.User{}=user}) ->
IO.puts("Found user #{inspect(user)}")
{_, :error} ->
IO.puts("Error occurred")
end)
For a post with url like this https://www.instagram.com/p/BJYkFQPgwGD sync:
Instagram.Post.get("BJYkFQPgwGD")
async:
Instagram.Post.get("BJYkFQPgwGD",
fn ({_post_id, %Instagram.Post{}=post}) ->
IO.puts("Found post: #{inspect(post)}")
({_post_id, :error}) ->
IO.puts("Error occurred")
end)
async:
Instagram.Post.get_user_posts("instagram",[per_page: 10, limit: 100],
fn ({_username, %{posts: posts, total: total}}) ->
IO.puts("Found posts: #{inspect(posts)}")
:continue # return :continue to continue or :stop to stop next batch
({_username, :done}) ->
IO.puts("Done")
({_username, :user_not_fount})->
IO.put("User not found")
end)
Instagram.Search.hashtag("chalewote", [],
fn posts ->
end)
Instagram.Search.search_users("badu",
fn users ->
end)