AnonClient (Low-Level)¶
Direct access to anonymous Instagram endpoints. Used internally by PublicAPI.
Prefer PublicAPI
For most use cases, use ig.public.* methods. AnonClient is for advanced users who need direct endpoint control.
Strategy Methods¶
get_profile_html(username)¶
Parse profile from HTML page (SharedData + meta tags).
get_embed_data(shortcode)¶
Get post data from embed endpoint.
get_graphql_public(query_hash, variables)¶
Make public GraphQL query.
data = client.get_graphql_public(
query_hash="d4d88dc1500312af6f937f7b804c68c3",
variables={"user_id": "173560420", "first": 12}
)
get_web_api(path, params=None)¶
Make web API request to i.instagram.com/api/v1/.
get_mobile_api(path, params=None)¶
Make mobile API request to i.instagram.com/api/v1/.
Endpoint Methods¶
get_web_profile(username)¶
Get profile via web API strategy.
Returns: (profile_dict, posts_list) or (None, [])
get_user_info_mobile(user_id)¶
Get user info via mobile API.
search_web(query)¶
Search via web API.
Returns:
{
"users": [{"username": ..., "follower_count": ...}],
"hashtags": [{"name": ..., "media_count": ...}],
"places": [{"title": ..., "location": {...}}],
}
get_user_reels(user_id, max_id=None)¶
Get reels via mobile API.
Returns:
{
"items": [{"pk": ..., "play_count": ..., "is_reel": True, ...}],
"more_available": True,
"next_max_id": "cursor..."
}
get_user_feed_mobile(user_id, count=12, max_id=None)¶
Get user feed via mobile API.
Returns:
{
"items": [{"pk": ..., "likes": ..., "shortcode": ..., ...}],
"more_available": True,
"next_max_id": "cursor..."
}
get_media_info_mobile(media_id)¶
Get single media details.
get_hashtag_sections(hashtag, max_id=None)¶
Get hashtag posts via sections API.
get_location_sections(location_id, max_id=None)¶
Get location posts via sections API.
get_similar_accounts(user_id)¶
Get similar/recommended accounts.
get_highlights_tray(user_id)¶
Get highlight tray metadata.
Parser Methods¶
| Method | Input | Output |
|---|---|---|
_parse_graphql_user(user) |
GraphQL user dict | Normalized profile |
_parse_timeline_edges(edges) |
GraphQL edges | Post list |
_parse_mobile_feed_item(item) |
Mobile API item | Normalized post |
_parse_embed_media(media) |
Embed response | Normalized post |
_parse_meta_tags(html) |
HTML string | Profile from meta |
_parse_count(text) |
"1.5M" / "12K" | int |