Package: scrapify-ig
Python Instagram Scraper API SDKLibrary - wrapper over instagrapi scraper API.Used by API:https://rapidapi.com/fama-official-instagram-scraper/api/instagram-scraper-api2This library provides basic data retrieval features with instagram: Users, Posts, Comments, etc. Read more below.Warning:It’s just a wrapper on the API.  If the API stops working, the library stops working.Quick Access:Get startedAvailable featuresComing soonInstallationUsageExamplesTypesErrors and IssuesGet StartedAvailable features:Get User infoGet User medias with paginationGet User Followers with paginationGet Media Post infoGet Media Post Comments with paginationGet Media Posts by Tagged userGet Media Posts by HashtagGet Similar UsersSearch Users, Hashtags and PlacesGet Media Post Likes with paginationComing soon:Get User Following with paginationGet User StoriesGet Story InfoGet User HighlightsInstallation:Pre-requirements:Python >= 3.9vWith pip (https://pypi.org/project/scrapify-ig/):pipinstallscrapify-igUsage:Before using the library, you need to get the RapidAPI API:https://rapidapi.com/fama-official-instagram-scraper/api/instagram-scraper-api2Use the client object to use all possible library functions. Create client object:fromscrapify_igimportClientTOKEN="<RapidAPI Token>"client=Client(token=TOKEN)Now you are ready to use the library.Get user information:Seeexamples/user_info.mdfor more detailsuser_info=client.get_user_info(username_or_id_or_url="nike",include_about=False,url_embed_safe=False)# Returns: types.User instanceGet user media posts:Seeexamples/user_medias.mdfor more detailsfromscrapify_igimporttypes,exceptionsuser_medias_chunk:types.MediaPostsChunk=client.get_user_medias_chunk(username_or_id_or_url="nike",url_embed_safe=False)# Returns: types.MediaPostsChunk.# Posts are available in the data field: user_medias.data.# To get the next chank, call again get_user_medias_chunk again and specify the pagination_token argument.# pagination_token is the object field types.MediaPostsChunk.# Example:next_user_medias_chunk:types.MediaPostsChunk=client.get_user_medias_chunk(username_or_id_or_url="nike",pagination_token=user_medias_chunk.pagination_token)# OR:# You can use the interface .next_chunk:next_users_medias_chunk:types.MediaPostsChunk=user_medias_chunk.next_chunk()# Warning:# .next_chunk throws exceptions.NoNextPageError an error if there is no next page.# It is recommended to use first check that there is the following page.# Example:ifuser_medias_chunk.has_next_chunk():next_users_medias_chunk:types.MediaPostsChunk=user_medias_chunk.next_chunk()# OR:try:next_users_medias_chunk:types.MediaPostsChunk=user_medias_chunk.next_chunk()exceptexceptions.NoNextPageError:# do somethingpassGet user followers:fromscrapify_igimporttypesusername="nike"user_followers_chunk:types.FollowersChunk=client.get_followers_chunk(username)next_user_followers_chunk:types.FollowersChunk=client.get_followers_chunk(username,pagination_token=user_followers_chunk.pagination_token)# Also works .next_chunk interface:next_user_followers_chunk:types.FollowersChunk=user_followers_chunk.next_chunk()Get Media Post info:Seeexamples/media_info.mdfor more detailsfromscrapify_igimporttypesmedia_identifier="Cx8yen-uS-d"# media code, id or urlmedia_info:types.MediaPost=client.get_media_info(code_or_id_or_url=media_identifier,url_embed_safe=False)Get Media Post Comments:fromscrapify_igimporttypes,exceptionsmedia_identifier="Cx8yen-uS-d"# media code, id or urlmedia_comments_chunk:types.CommentsChunk=client.get_media_comments_chunk(code_or_id_or_url=media_identifier)# Also works .next_chunk interface:ifmedia_comments_chunk.has_next_chunk():next_media_comments_chunk:types.CommentsChunk=media_comments_chunk.next_chunk()# Note:# Comments have answers to comments. There are no answers to comments.# You need to call client.get_comment_thread_chunk to get answers to a specific comment.# Example:some_comment_with_child:types.CommentsChunkItem=media_comments_chunk.data.items[6]child_comments_chunk:types.CommentsThreadChunk=some_comment_with_child.get_comment_thread_chunk(client)# OR:child_comments_chunk:types.CommentsThreadChunk=client.get_comment_thread_chunk(comment_id=some_comment_with_child.id)# Warning:# If there is no child comment, the HTTPNotFoundError exception will be discarded# use the .has_thread_comments method to prevent the error:ifsome_comment_with_child.has_thread_comments():child_comments_chunk:types.CommentsThreadChunk=client.get_comment_thread_chunk(comment_id=some_comment_with_child.id)# OR:try:child_comments_chunk:types.CommentsThreadChunk=client.get_comment_thread_chunk(comment_id=some_comment_with_child.id)exceptexceptions.HTTPNotFoundError:# do somethingpassGet Media Posts by Tagged user:fromscrapify_igimporttypesuser_identifier="nike"tagged_posts_chunk:types.TaggedMediaPostsChunk=client.get_tagged_medias_chunk(username_or_id_or_url=user_identifier)# Also works .next_chunk interface:iftagged_posts_chunk.has_next_chunk():next_tagged_posts_chunk:types.TaggedMediaPostsChunk=tagged_posts_chunk.next_chunk()# OR:next_tagged_posts_chunk:types.TaggedMediaPostsChunk=client.get_tagged_medias_chunk(username_or_id_or_url=user_identifier,pagination_token=tagged_posts_chunk.pagination_token)Get Media Posts by Hashtag:fromscrapify_igimporttypeshashtag="nike"hashtag_medias_chunk:types.MediaPostsHashtagChunk=client.get_medias_by_hashtag_chunk(hashtag=hashtag)# Also works .next_chunk interface:ifhashtag_medias_chunk.has_next_chunk():next_hashtag_medias_chunk:types.MediaPostsHashtagChunk=hashtag_medias_chunk.next_chunk()# OR:next_hashtag_medias_chunk:types.MediaPostsHashtagChunk=client.get_medias_by_hashtag_chunk(hashtag=hashtag,pagination_token=hashtag_medias_chunk.pagination_token)Get Similar Users:fromscrapify_igimporttypesuser_identifier="nike"similar_accounts:types.SimilarAccounts=client.get_similar_accounts(username_or_id_or_url=user_identifier)# Note:# pagination not allowedSearch Users, Hashtags and Places:fromscrapify_igimporttypessearch_query="London"search_result:types.SearchResult=client.search(search_query=search_query)# Note:# pagination not allowedGet Media Post Likes with pagination:fromscrapify_igimporttypesmedia_identifier="Cx8yen-uS-d"# media code, id or urlmedia_likes_chunk:types.LikesMediaPostsChunk=client.get_media_likes_chunk(code_or_id_or_url=media_identifier)# Also works .next_chunk interface:ifmedia_likes_chunk.has_next_chunk():media_likes_chunk:types.LikesMediaPostsChunk=media_likes_chunk.next_chunk()Types:user scrapify_ig.types for better typing. Also in this module you can see all available fields for each objectErrors and Issues:If you notice an error or problem, please write about it herehttps://gitlab.com/oleksii.stulen.public/scrapify-ig/issues. Describe the problem as precisely as possible. What did you do, what did you want to get, how did you do it and so on. Thank you!Author: Oleksii StulenEmail:oleksii.stulen.workspace@gmail.com