{"id":28268588,"url":"https://github.com/niuware/instpector","last_synced_at":"2025-08-30T07:06:27.610Z","repository":{"id":62571178,"uuid":"195188162","full_name":"niuware/instpector","owner":"niuware","description":"A simple Instagram's web API library","archived":false,"fork":false,"pushed_at":"2020-05-26T03:09:07.000Z","size":60,"stargazers_count":17,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-29T13:48:37.377Z","etag":null,"topics":["instagram","instagram-api","instagram-api-python","instagram-client","library","python","web-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niuware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-04T07:09:50.000Z","updated_at":"2023-08-01T02:44:48.000Z","dependencies_parsed_at":"2022-11-03T18:26:03.894Z","dependency_job_id":null,"html_url":"https://github.com/niuware/instpector","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/niuware/instpector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niuware%2Finstpector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niuware%2Finstpector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niuware%2Finstpector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niuware%2Finstpector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niuware","download_url":"https://codeload.github.com/niuware/instpector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niuware%2Finstpector/sbom","scorecard":{"id":689496,"data":{"date":"2025-08-11","repo":{"name":"github.com/niuware/instpector","commit":"c7cdca3939e3dd20dad39c6441d313729b21c355"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T01:57:14.319Z","repository_id":62571178,"created_at":"2025-08-22T01:57:14.320Z","updated_at":"2025-08-22T01:57:14.320Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272816166,"owners_count":24997720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["instagram","instagram-api","instagram-api-python","instagram-client","library","python","web-api"],"created_at":"2025-05-20T15:13:04.569Z","updated_at":"2025-08-30T07:06:27.602Z","avatar_url":"https://github.com/niuware.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instpector\n\nA simple Instagram's web API library written in Python. Supports login with two-factor authentication enabled. No selenium or webdriver required.\n\n## Installation\n\n```\npip install instpector\n```\n\n# Sample usage\n\n```python\nfrom instpector import Instpector, endpoints\n\ninstpector = Instpector()\ninstpector.login(\"my_username\", \"my_password\")\n\nprofile = endpoints.factory.create(\"profile\", instpector)\nfollowers = endpoints.factory.create(\"followers\", instpector)\n\ninsta_profile = profile.of_user(\"some_username\")\n\n# Loop through all followers\nfor follower in followers.of_user(insta_profile.id):\n    print(follower.username)\n\ninstpector.logout()\n```\n\n## Using 2FA\nFor login in using two-factor authentication, generate your 2fa key once on the  Instagram's app and provide the code when logging in with `instpector`. The following example uses `pytop` library to demonstrate the usage:\n\n```python\nfrom pyotp import TOTP\nfrom instpector import Instpector, endpoints\n\ninstpector = Instpector()\ntotp = TOTP(\"my_2fa_key\") # Input without spaces\n\n# Login into Instagram's web\ninstpector.login(\"my_username\", \"my_password\", totp.now())\n```\n\n# Examples\n\nCheck out more examples [here](https://github.com/niuware/instpector/tree/master/examples).\n\n# Endpoints\n\n- Followers   \n- Following   \n- Timeline   \n- Comments\n- Profile   \n- Story Reel    \n- Story    \n\nMore to come\n\n# API\n\n## Classes\n\n`Instpector`\n\n|Method|Details|\n|---|---|\n|login(user: `str`, password: `str`, two_factor_code: `str` = None) -\u003e `bool`|Login to an Instagram account. If your account is 2FA protected provide the 2FA code as in the [provided example](https://github.com/niuware/instpector/blob/master/examples/two_factor_auth.py).|\n|logout()|Logouts from an Instagram account.|\n|session() -\u003e `Session`|Returns the current session used by `instpector`.|\n\n`EndpointFactory`\n\n|Method|Details|\n|---|---|\n|create(endpoint_name: `str`, instpector_instance: `Instpector`)|Creates and returns an endpoint instance based on the provided name. Available endpoint names are: `\"followers\"`, `\"following\"`, `\"profile\"`, `\"timeline\"`, `\"comments\"` `\"story_reel\"` and `\"story\"`.|\n\n## Endpoints\n\n### Profile\n\nGets the profile of any public or friend user account.\n\n|Method|Details|\n|---|---|\n|of_user(username: `str`) -\u003e `TProfile`|Returns a `TProfile` instance for the provided username.|\n|follow(user: `TProfile` \\| `str`) -\u003e `bool`|Follows a user. You can provide a `TProfile` instance or an Instagram's user Id.|\n|unfollow(user: `TProfile` \\| `str`) -\u003e `bool`|Unfollows a user. You can provide a `TProfile` instance or an Instagram's user Id.|\n|activity() -\u003e `TActivity`|Yields a list of `TActivity` items for the current logged in account.|\n\n### Followers\n\nEndpoint for accessing the follower list of any public or friend user account.\n\n|Method|Details|\n|---|---|\n|of_user(user_id: `str`) -\u003e `TUser`|Yields a list of `TUser` instances with all followers. Note the method receives a user id and not a username. To get the user id use the `Profile` endpoint.|\n\n### Following\n\nEndpoint for accessing the followees list of any public or friend user account.\n\n|Method|Details|\n|---|---|\n|of_user(user_id: `str`) -\u003e `TUser` |Yields a list of `TUser` instances with all followees. Note the method receives a user id and not a username. To get the user id use the `Profile` endpoint.|\n\n### Timeline\n\nEndpoint for accessing the timeline of any public or friend account.\n\n|Method|Details|\n|---|---|\n|of_user(user_id: `str`) -\u003e `TTimelinePost`|Yields a list of `TTimelinePost` instances with all timeline posts. Note the method receives a user id and not a username. To get the user id use the `Profile` endpoint.|\n|download(timeline_post: `TTimelinePost`, only_image: `bool` = False, low_quality: `bool` = False)|Downloads and save the available resources (image and video) for the provided `TTimelinePost`. The file name convention is `ownerid_resourceid.extension` and saved in the execution directory. If `low_quality` is `True` the resource will be the downloaded with the lowest size available (only for image). If `only_image` is `True` a video file resource won't be downloaded.|\n|like(timeline_post: `TTimelinePost` \\| `TActivityPost`) -\u003e `bool`|Likes a post.|\n|unlike(timeline_post: `TTimelinePost` \\| `TActivityPost`) -\u003e `bool`|Unlikes a post.|\n\n### Comments\n\nEndponint for accessing comments and threaded comments of any public or friends post or comment.\n\n|Method|Details|\n|---|---|\n|of_post(timeline_post: `TTimelinePost` \\| `TActivityPost`) -\u003e `TComment`|Yields a list of `TComment` instances with all post comments.|\n|of_comment(comment: `TComment`) -\u003e `TComment`|Yields a list of `TComment` instances with all threaded comments of a comment.|\n|like(comment: `TComment`) -\u003e `bool`|Likes a comment.|\n|unlike(comment: `TComment`) -\u003e `bool`|Unlikes a comment.|\n|add(timeline_post: `TTimelinePost` \\| `TActivityPost`, text: `str`, parent_comment: `TComment` = None) -\u003e `TComment` \\| `None`|Adds a new comment to a post. You can reply to a comment if `parent_comment` argument is provided. An instance of the created comment is return if succeeded otherwise `None`.|\n|remove(timeline_post: `TTimelinePost` \\| `TActivityPost`, comment: `TComment`) -\u003e `bool`|Removes a comment from a post. Only comments authored by the current logged in account can be removed.|\n\n### StoryReel\n\nEndpoint for accessing the story reel (stories) of any public or friend user account.\n\n|Method|Details|\n|---|---|\n|of_user(user_id: `str`) -\u003e `TStoryReelItem`|Yields a list of `TStoryReelItem` instances with all stories. Note the method receives a user id and not a username. To get a user id use the `Profile` endpoint.|\n|download(story_item: `TStoryReelItem`, only_image: `bool` = False, low_quality: `bool` = False)|Downloads and save the available resources (image and video) for the provided `TStoryReelItem`. The file name convention is `ownerid_resourceid.extension` and saved in the execution directory. If `low_quality` is `True` the resource will be the downloaded with the lowest size available. If `only_image` is `True` a video file resource won't be downloaded.|\n\n### Story\n\nEndpoint for accessing the story details of a story reel item. This endpoint is only available for stories posted by the current logged in user.\n\n|Method|Details|\n|---|---|\n|viewers_for(story_id: `str`) -\u003e `TStoryViewer`|Yields a list of `TStoryViewer` instances with all viewers of the provided story id.|\n\n## Types\n\n### TUser\n\n|Field|Type|Details|\n|---|---|---|\n|id|`str`|The Instagram Id of the user|\n|username|`str`|The user's name|\n|full_name|`str`|The full name of the user|\n|is_private|`bool`|A flag to show if the user account is private|\n\n### TProfile\n\n|Field|Type|Details|\n|---|---|---|\n|id|`str`|The Instagram Id of the user|\n|username|`str`|The user's name|\n|biography|`str`|The biography of the user|\n|is_private|`bool`|A flag to show if the user account is private|\n|followers_count|`integer`|The follower count of the user|\n|following_count|`integer`|The following count of the user|\n\n### TTimelinePost\n|Field|Type|Details|\n|---|---|---|\n|id|`str`|The Instagram Id of the post|\n|shortcode|`str`|The Instagram shortcode Id of the post|\n|owner|`str`|The post author's Instagram Id|\n|timestamp|`integer`|The created timestamp of the post|\n|caption|`str`|The caption of the post|\n|is_video|`bool`|A flag to know if the post is a video|\n|like_count|`integer`|The like count of the post|\n|comment_count|`integer`|The comment count of the post|\n|display_resources|`list`|A list of image URL strings associated with the post|\n|video_url|`str`|The video URL (if available) associated with the post|\n\n### TComment\n|Field|Type|Details|\n|---|---|---|\n|id|`str`|The Instagram Id of the comment|\n|text|`str`|The text of the comment|\n|username|`str`|The author's username|\n|timestamp|`integer`|The timestamp of the comment|\n|viewer_has_liked|`bool`|A flag to know if the viewer liked the comment|\n|liked_count|`integer`|The like count of the comment|\n|thread_count|`integer` \\| `None`|The comment's thread comments count. This value is `None` if the instance is a threaded comment.|\n\n### TStoryReelItem\n|Field|Type|Details|\n|---|---|---|\n|id|`str`|The Instagram Id of the story|\n|owner|`str`|The story author's Instagram Id|\n|timestamp|`integer`|The created timestamp of the story|\n|expire_at|`integer`|The expiration timestamp of the story|\n|audience|`str`|The type of audience of the story. If public the value is `MediaAudience.DEFAULT`, if private the value is `MediaAudience.BESTIES`|\n|is_video|`bool`|A flag to know if the story is a video|\n|view_count|`integer`|The view count of the story. The count is only available for stories posted by the currently logged in user. Other accounts will have a count equal to `0`|\n|display_resources|`list`|A list of image URL strings associated with the story|\n|video_resources|`list`|A list of video URL strings associated with the story|\n\n### TStoryViewer\n|Field|Type|Details|\n|---|---|---|\n|id|`str`|The Instagram Id of the story viewer|\n|username|`str`|The user name of the viewer|\n\n### TActivity\n|Field|Type|Details|\n|---|---|---|\n|id|`str`|The Instagram Id of the activity|\n|timestamp|`integer`|The timestamp of the activity|\n|username|`str`|The user name linked to the activity|\n|activity_type|`str`|The activity type. Either `NEW_LIKE` or `NEW_FOLLOW`|\n|liked_post|`TActivityPost` \\| `None`|If the activity type is `NEW_LIKE`, an `TActivityPost` instance is returned|\n\n### TActivityPost\n|Field|Type|Details|\n|---|---|---|\n|id|`str`|The Instagram Id of the post|\n|shortcode|`str`|The Instagram shortcode Id of the post|\n|thumbnail_resources|`list`|A list of thumbnails URL strings associated with the post|\n\n# Development dependencies\n\n- requests\n\n# Tests\n\n1. Create a `pytest.ini` file with the sample contents of  `pytest.sample.ini` in the `tests` directory.\n\n2. Add your account information. \n3. Run with `pytest`:\n```\n(env)$ pytest -qs tests\n```\n\n# Disclaimer\n\nThis tool is not affiliated with, authorized, maintained or endorsed by Instagram or any of its affiliates or subsidiaries. Use at your own risk.\n\n# License\n\nLicensed under MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniuware%2Finstpector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniuware%2Finstpector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniuware%2Finstpector/lists"}