Giter Site home page Giter Site logo

instagram_private_api's People

Contributors

jwtrhs avatar ping avatar qu4tro avatar quantifiedcode-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

instagram_private_api's Issues

Proxy support

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Describe your issue

I can see that proxy support now is alpha. What kind of issues I'll face and what carefully should I look for?

Most efficient way to check for live broadcasts from specific users?

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Live Broadcast Notifications

It's been a few weeks since I looked at this in detail, but I didn't see any lightweight "are these users streaming right now" endpoint. There's two slightly different ways of getting suggested/popular streams (discover_top_live, suggested_broadcasts), and I can check users individually through user_story_feed, but there doesn't seem to be an equivalent of the latter for multiple users (like reels_media but including broadcasts). Or did I miss something?

top_live_status looks promising, but I've no idea how broadcast ids map to users.

Ideally I'd like something I can check fairly frequently throughout the day.

Video uploads failing

Have:

Which client are you using?

  • app (instagram_private_api/) + (instagram_private_api_extensions)
  • web (instagram_web_api/)

Purpose of issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Output of python -V :

Python 2.7.10

Example code that will produce the error reported :

import json
import codecs
import datetime
import os.path
import logging
import argparse
import traceback

try:
    import instagram_private_api as app_api
except ImportError:
    import sys
    sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
    import instagram_private_api as app_api

from instagram_private_api_extensions import media

def to_json(python_object):
    if isinstance(python_object, bytes):
        return {'__class__': 'bytes',
                '__value__': codecs.encode(python_object, 'base64').decode()}
    raise TypeError(repr(python_object) + ' is not JSON serializable')


def from_json(json_object):
    if '__class__' in json_object:
        if json_object['__class__'] == 'bytes':
            return codecs.decode(json_object['__value__'].encode(), 'base64')
    return json_object


def onlogin_callback(api, new_settings_file):
    cache_settings = api.settings
    with open(new_settings_file, 'w') as outfile:
        json.dump(cache_settings, outfile, default=to_json)
        print('SAVED: %s' % new_settings_file)


if __name__ == '__main__':

    logging.basicConfig()
    logger = logging.getLogger('instagram_private_api')
    logger.setLevel(logging.WARNING)

    # Example command:
    # python examples/savesettings_logincallback.py -u "yyy" -p "zzz" -settings "test_credentials.json"
    parser = argparse.ArgumentParser(description='login callback and save settings demo')
    parser.add_argument('-settings', '--settings', dest='settings_file_path', type=str, required=True)
    parser.add_argument('-u', '--username', dest='username', type=str, required=True)
    parser.add_argument('-p', '--password', dest='password', type=str, required=True)
    parser.add_argument('-debug', '--debug', action='store_true')

    args = parser.parse_args()
    if args.debug:
        logger.setLevel(logging.DEBUG)

    print('Client version: %s' % app_api.__version__)

    try:

        settings_file = args.settings_file_path
        if not os.path.isfile(settings_file):
            # settings file does not exist
            print('Unable to find file: %s' % settings_file)

            # login new
            api = app_api.Client(
                args.username, args.password,
                on_login=lambda x: onlogin_callback(x, args.settings_file_path))
        else:
            with open(settings_file) as file_data:
                cached_settings = json.load(file_data, object_hook=from_json)
            print('Reusing settings: %s' % settings_file)

            # reuse auth settings
            api = app_api.Client(
                args.username, args.password,
                settings=cached_settings)

    except (app_api.ClientCookieExpiredError, app_api.ClientLoginRequiredError) as e:
        print('ClientCookieExpiredError/ClientLoginRequiredError: %s' % e)

        # Login expired
        # Do relogin but use default ua, keys and such
        api = app_api.Client(
            args.username, args.password,
            on_login=lambda x: onlogin_callback(x, args.settings_file_path))

    except app_api.ClientLoginError as e:
        print('ClientLoginError %s' % e)
        exit(9)
    except app_api.ClientError as e:
        print('ClientError %s (Code: %d, Response: %s)' % (e.msg, e.code, e.error_response))
        exit(9)
    except Exception as e:
        print('Unexpected Exception: %s' % e)
        exit(99)

    # Show when login expires
    cookie_expiry = api.cookie_jar.expires_earliest
    print('Cookie Expiry: %s' % datetime.datetime.fromtimestamp(cookie_expiry).strftime('%Y-%m-%dT%H:%M:%SZ'))

    # Call the api
    results = api.tag_search('cats')
    assert len(results.get('results', [])) > 0
    print('All ok')
	
    try :
        # post a video story
        vid_data, vid_size, vid_duration, vid_thumbnail = media.prepare_video('8.mp4', aspect_ratios=api.reel_ratios())
        api.post_video_story(vid_data, vid_size, vid_duration, vid_thumbnail)
    except :
        var = traceback.format_exc()
        with open('log.txt', 'w') as log:
            log.write(var)

Error/Debug Log :

Traceback (most recent call last):
  File "myUpload.py", line 116, in <module>
    api.post_video_story(vid_data, vid_size, vid_duration, vid_thumbnail)
  File "D:\insta\ping\instagram_private_api\instagram_private_api\endpoints\upload.py", line 592, in post_video_story
    thumbnail_data=thumbnail_data, to_reel=True)
  File "D:\insta\ping\instagram_private_api\instagram_private_api\endpoints\upload.py", line 567, in post_video
    return self.configure_video_to_reel(upload_id, size, duration, thumbnail_data)
  File "D:\insta\ping\instagram_private_api\instagram_private_api\endpoints\upload.py", line 298, in configure_video_to_reel
    res = self.post_photo(thumbnail_data, size, '', upload_id=upload_id, to_reel=True)
  File "D:\insta\ping\instagram_private_api\instagram_private_api\endpoints\upload.py", line 431, in post_photo
    return self.configure_to_reel(upload_id, size)
  File "D:\insta\ping\instagram_private_api\instagram_private_api\endpoints\upload.py", line 279, in configure_to_reel
    res = self._call_api(endpoint, params=params)
  File "D:\insta\ping\instagram_private_api\instagram_private_api\client.py", line 434, in _call_api
    raise ClientError(error_msg, e.code, error_response)
ClientError: Bad Request: Transcode error: Video file does not contain duration

Issue

When above code ran with,
python myUpload.py -u "username" -p "password" -settings "user.json"
Video uploads fails , with Transcode error: Video file does not contain duration

How to avoid losing connections

This project is really great, It's absolutely omnipotent.
But I still have some obstacles.
when I use it,It happens all the time

  1. urllib.error.URLError: <urlopen error [WinError 10054] ่ฟœ็จ‹ไธปๆœบๅผบ่ฟซๅ…ณ้—ญไบ†ไธ€ไธช็Žฐๆœ‰็š„่ฟžๆŽฅใ€‚>
  2. ConnectionResetError: [WinError 10054] ่ฟœ็จ‹ไธปๆœบๅผบ่ฟซๅ…ณ้—ญไบ†ไธ€ไธช็Žฐๆœ‰็š„่ฟžๆŽฅใ€‚
    then, how to avoid it

How to avoiding re-login?

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Paste the output of python -V here: 3.5.3


Describe your issue

I see in docs warning about avoiding re-login:

You are advised to persist/cache the auth cookie details to avoid logging in every time you make an api call. Excessive logins is a surefire way to get your account flagged for removal. It's also advisable to cache the client details such as user agent, etc together with the auth details.

The saved auth cookie can be reused for up to 90 days.

But how to make that? Any example will be nice to understand! Please.

TAG USER IN STORY

Please follow the guide below

  • Issues submitted without this template format will likely be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x]).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

Which client are you using?

  • [x ] app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


Describe your issue

Hello, HOW CAN I TAG USERS IN STORY POST?
Explanation of your issue goes here. Please make sure the description is worded well enough to be understood with as much context and examples as possible.

What to do after a suspicious flag? ClientError Bad Request: challenge_required

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here:
Python 3.6.1

Code:

def ig_login(username, password, _ID):
    registered_users_file = THIS_FOLDER_G + "/db/__rgstd__.json"
    with open(registered_users_file, 'r') as infile:
        registered_users = json.load(infile)
    if username not in registered_users:
        registered_users[username] = False
        with open(registered_users_file, 'w') as outfile:
            json.dump(registered_users, outfile, indent=2)
        return {"status": "error", "msg": "New User."}
    
    device_id = None
    settings_file = THIS_FOLDER_G + "/db/data/cookies/" + username + "_" + _ID + ""

    try:
        if not os.path.isfile(settings_file):
            # settings file does not exist
            print('Unable to find file: {0!s}'.format(settings_file))

            # login new
            api = Client(
                username, password,
                device_id=device_id,
                on_login=lambda x: onlogin_callback(x, settings_file))
        else:
            with open(settings_file) as file_data:
                cached_settings = json.load(file_data, object_hook=from_json)
            print('Reusing settings: {0!s}'.format(settings_file))

            device_id = cached_settings.get('device_id')
            # reuse auth settings
            api = Client(
                username, password,
                settings=cached_settings)
        
        current_user = api.current_user()

    except (ClientCookieExpiredError, ClientLoginRequiredError) as e:
        print('ClientCookieExpiredError/ClientLoginRequiredError: {0!s}'.format(e))
        # if os.path.isfile(settings_file):
        #     os.remove(settings_file)
        return {"status": "error", "msg": "Invalid Username or Password."}
        # Login expired
        # Do relogin but use default ua, keys and such
        # settings_file = THIS_FOLDER_G + "/db/data/cookies/" + username + "_" + _ID + ""
        # api = Client(
        #     username, password,
        #     device_id=device_id,
        #     on_login=lambda x: onlogin_callback(x, settings_file))

    except ClientLoginError as e:
        print('ClientLoginError {0!s}'.format(e))
        # if os.path.isfile(settings_file):
        #     os.remove(settings_file)
        return {"status": "error", "msg": "Invalid Username or Password."}

    except ClientError as e:
        print('ClientError {0!s} (Code: {1:d}, Response: {2!s})'.format(e.msg, e.code, e.error_response))
        # if os.path.isfile(settings_file):
        #     os.remove(settings_file)
        return {"status": "error", "msg": "Invalid Username or Password."}

    except Exception as e:
        print('Unexpected Exception: {0!s}'.format(e))
        return {"status": "error", "msg": "Something went wrong."}

    # Show when login expires
    cookie_expiry = api.cookie_jar.expires_earliest
    print('Cookie Expiry: {0!s}'.format(datetime.datetime.fromtimestamp(cookie_expiry).strftime('%Y-%m-%dT%H:%M:%SZ')))

    print('All ok')

    if registered_users[username] == False:
        registered_users[username] = True
        with open(registered_users_file, 'w') as outfile:
            json.dump(registered_users, outfile, indent=2)

    return api


@app.route('/login', methods=["POST"])
def login():
    _ID = request.form.get('_ID')
    username = request.form.get('username')
    password = request.form.get('password')

    try:
        SEC_KEY = get_SEC_KEY(_ID)
        if SEC_KEY == "Not Found":
            return jsonify({"status": "error", "msg": "Secret Key Not Found"})

        password = decrypt_data(password, SEC_KEY)
    except:
        return jsonify({"status": "error", "msg": "Encryption Error."})

    api = ig_login(username, password, _ID)

    if isinstance(api, dict) and "status" in api and api["status"] == "error":
        return jsonify(api)
    else:
        user_id = api.authenticated_user_id
        current_user = api.current_user()

        followers = api.user_followers(user_id)
        initial_followers_file = THIS_FOLDER_G + "/db/data/initial_followers/" + username + ".json"
        if not os.path.isfile(initial_followers_file):
            with open(initial_followers_file, 'w') as outfile:
                json.dump(followers, outfile, indent=None)
                print('SAVED: {0!s}'.format(initial_followers_file))
        else:
            pass
        
        IDS_PATH = THIS_FOLDER_G + "/db/__ids__.json"
        with open(IDS_PATH, 'r') as infile:
            ID_ENTRIES = json.load(infile)
        
        if username in ID_ENTRIES:
            if _ID not in ID_ENTRIES[username]:
                ID_ENTRIES[username].append(_ID)
        else:
            ID_ENTRIES[username] = []
            ID_ENTRIES[username].append(_ID)
        
        with open(IDS_PATH, 'w') as outfile:
            json.dump(ID_ENTRIES, outfile, indent=2)

        return jsonify(current_user)

Complete File Link:
https://github.com/ahmednooor/instagram_unfollow_check/blob/master/app.py

Error/Debug Log:
On first login request:

ClientError URLError <urlopen error timed out> (Code: 0, Response: )

And on later login requests:

ClientError Bad Request: challenge_required (Code: 400, Response: {"message": "challenge_required", "challenge": {"url": "https://i.instagram.com/challenge/<mock_value>/<mock_value>/", "api_path": "/challenge/<mock_value>/<mock_value>/", "hide_webview_header": true, "lock": true, "logout": false, "native_flow": true}, "status": "fail", "error_type": "checkpoint_challenge_required"})

Describe your issue

Background:
I am creating a REST api with Flask for an app and using this api to check followers, unfollowers etc.
It was working fine for past couple days but suddenly raising challange_required error.
Question:
What to do after a suspicious flag? I have marked (this was me) and confirmed with secret code but the error is still there. Any advice/solution on the matter would be extremely appreciated.
Thanks.

How to filtering photos with username and hashtag (both)?

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here: Python 3.6.1

Describe your issue

Hello. This is small question, I doesn't found on docs.

How to filtering photos with username and hashtag (both)? This package can do it? How?

Update README for usage of private API

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x]).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


Describe your issue

The example of usage of the private API in the README does not work. The dictionary results returned by api.feed_timeline() seems to have been updated.
The following changes in README should work:

@@ -73,11 +73,11 @@ password = 'YOUR_PASSWORD'
 
 api = Client(user_name, password)
 results = api.feed_timeline()
-items = results.get('items', [])
+items = results.get('feed_items', [])
 for item in items:
     # Manually patch the entity to match the public api as closely as possible, optional
     # To automatically patch entities, initialise the Client with auto_patch=True
-    ClientCompatPatch.media(item)
+    media = ClientCompatPatch.media(item['media_or_ad'])
     print(media['code'])

[Question] Is there any way to avoid/deal with 'challenge required' error?

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x]).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering are out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • [ x ] Updated to the lastest version v1.3.5
  • [ x ] Read the README and docs
  • [ x ] Searched the bugtracker for similar issues including closed ones
  • [ x ] Reviewed the sample code in tests and examples

Which client are you using?

  • [ x ] app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • [ x ] Question
  • Other

Describe your issue

Hi, @ping! Many thanks for your library it's awesome!
I want to provide some context before I'll get to the question part. I started using your library on my local machine but when I moved to VPS which is located far away from me I got this error pretty much every time:

instagram_private_api.errors.ClientError: Bad Request: challenge_required

I figure out that Instagram wants me to confirm login attempt or entered the security code on the login page.
So, if there any way to avoid this rather than creating the Instagram account under VPN in the country where VPS located?

Thanks for your attention!

Can not delete comment

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.4.0
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Describe your issue

I found that somtimes it is impossiable to delete media comment. I tried app and web clients. Actualy I found instagram cliend for NodeJS with same problem. Instagram API returns
{'status': 'ok'}
But comment still on its place. It is possiable to delete it from instagram site or from device

[Question] How to save cookie and restore?

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x]).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here:

Code:

# Example code that will produce the error reported
from instagram_web_api import Client

web_api = Client()
user_feed_info = web_api.user_feed('1234567890', count=10)

Error/Debug Log:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

For a new endpoint feature request, you should include the capture of the request and response.

Request:

# Please provide your capture below
GET /api/v1/si/fetch_headers/?guid=123456abcdeff19cc2f123456&challenge_type=signup HTTP/1.1
Host: i.instagram.com
Connection: keep-alive
X-IG-Connection-Type: mobile(UMTS)
X-IG-Capabilities: 3ToAAA==
Accept-Language: en-US
Cookie: csrftoken=g79dofDBlVEA37II3LI7YdHeiMrd9ylj; mid=WFI52QABAAGrbKL-OZ4DtgLd9QIf
User-Agent: Instagram 10.3.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)
Accept-Encoding: gzip, deflate, sdch

Response:

# Please provide your capture below
HTTP/1.1 200 OK
Content-Language: en
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Vary: Cookie, Accept-Language
Pragma: no-cache
Cache-Control: private, no-cache, no-store, must-revalidate
Date: Thu, 15 Dec 2016 08:50:19 GMT
Content-Type: application/json
Set-Cookie: csrftoken=g79dofABCDEFGII3LI7YdHei1234567; expires=Thu, 14-Dec-2017 08:50:19 GMT; Max-Age=31449600; Path=/; secure
Connection: keep-alive
Content-Length: 16

{"status": "ok"}

Describe your issue

Explanation of your issue goes here. Please make sure the description is worded well enough to be understood with as much context and examples as possible.

"user_followers" gives inconsistent answers

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.4.0
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Python 3.6.0
instagram_private_api 1.3.6/1.4.0

from instagram_private_api import Client as Client_app
import json

app = Client_app(username='username', password='password')
profile_id = 'profile_with_more_than_7500_followers'
res = app.user_followers(profile_id)
print(json.dumps(res))


the code above doesn't output the same data, depending on the username used to log-in.

Login1:

{
  "users": [
   200 elements
  ],
  "big_list": true,
  "next_max_id": "AQDfEih8lalqSeBTPSvf.....",
  "page_size": 200,
  "status": "ok"
}

Login2:

{
  "users": [
   ~7500 elements
  ],
  "big_list": false,
  "page_size": 200,
  "status": "ok"
}

Some profile will always respond to that call with 200 elements, others with close to 7500 even if res['page_size'] == 200, without providing a "next_max_id"
Seems to me that this is server side, but maybe you know how to prevent this from happening

thanks for your help

How to get user id from username ? (App API)

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Describe your issue

Hi There !
I am using the api in order to take users' story reel, and my purpose is to take it for users I don't have their user id. Those are users who I don't follow for example (and they are not private) but I just want my program to get a username as an input and return the story feed for the specific user.

In other words, the question is how do I get user_id from username, I need that because the function "user_reel_media(user_id, **kwargs)" need user_id which I don't have, I only have his username.

The only way I found is combining the use of the 2 Api-s: the web and the app, and then I can solve it by using the user_info2 BUT, Is this the right way to do that ?

Thank you for your wonderful contribution

Retreive Top Posts of Hashtag

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

On the Instagram app when you look at the feed of a hashtag above the "Most Recent" appears 9 "Top Posts", these posts are not included with those in the "Most Recent" below. The feed_tag() function in the app API will get the "Most Recent", but there is no way to get the "Top Posts". Is it possible to to get these "Top Posts" either included in the feed or separately?

Account Create

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.4.0
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Describe your issue

I really want to use this API, but is there a feature for creating an account? Is it something I am not seeing? I have read all of the docs and cannot find it. I would add it myself but I would not know where to start. Thank you! This API is very in depth and looks extremely useful.

Most efficient way to check if user following you

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Describe your issue

Hi, I want my program to check if a user is following another user.
The input will be for example user "X" and then I check "Y" is followed by "X"/
Of course there are 2 ways to get to this, one by checking the following list of "X", and the second is checking the followers list of "Y".
Assuming that I want to use second method (Check in followers of "Y") what is the best way ? On Instagram real app there is a feature of follower search. I though about taking all the followers list of Y and check if "X" is in the list. but what if it is an account of 100K+ followers ?

Thank you !

What belongd into the JSON file?

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Describe your issue

Hey I am sorry but I am not that familiar with python and from your code I cant really read why a JSON file has to be put in as a parameter or what even belongs into the json file ๐Ÿค” .

Hope you could clarify that for me thanks!

Version 10.5.0

Anyone that has experience with patching certificate pinning that wants to take a look at 10.5.0 ?
They implemented a bypass for wifi proxy settings and seem to detect a MITM.

Probably cert pinning or something of this nature but I cannot locate the functionality.
There's no files popping up with checkClientTrusted, checkServerTrusted etc.

Both fiddler and charles show zero, no connection attempts, nothing.
I don't have a wireshark setup to check for other packets, but I am positive the app is not making any connection.

In-app I am getting a network error.

Checking if user has joined someone else's livestream (dual live)

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.4.0
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


Describe your issue

I was wondering if it would be possible to add functionality to check if a certain user is currently doing a Dual-Live with another user.

"reels_tray" endpoint no longer returning replays of archived live broadcasts

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x]).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here:

Code:

# Example code that will produce the error reported
from instagram_web_api import Client

web_api = Client()
user_feed_info = web_api.user_feed('1234567890', count=10)

Error/Debug Log:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

For a new endpoint feature request, you should include the capture of the request and response.

Request:

# Please provide your capture below
GET /api/v1/si/fetch_headers/?guid=123456abcdeff19cc2f123456&challenge_type=signup HTTP/1.1
Host: i.instagram.com
Connection: keep-alive
X-IG-Connection-Type: mobile(UMTS)
X-IG-Capabilities: 3ToAAA==
Accept-Language: en-US
Cookie: csrftoken=g79dofDBlVEA37II3LI7YdHeiMrd9ylj; mid=WFI52QABAAGrbKL-OZ4DtgLd9QIf
User-Agent: Instagram 10.3.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)
Accept-Encoding: gzip, deflate, sdch

Response:

# Please provide your capture below
HTTP/1.1 200 OK
Content-Language: en
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Vary: Cookie, Accept-Language
Pragma: no-cache
Cache-Control: private, no-cache, no-store, must-revalidate
Date: Thu, 15 Dec 2016 08:50:19 GMT
Content-Type: application/json
Set-Cookie: csrftoken=g79dofABCDEFGII3LI7YdHei1234567; expires=Thu, 14-Dec-2017 08:50:19 GMT; Max-Age=31449600; Path=/; secure
Connection: keep-alive
Content-Length: 16

{"status": "ok"}

Describe your issue

I didn't want to call it a bug (because I'm sure there's nothing wrong with your excellent project) but it seems as if they've changed the way this endpoint works. I can see archived live broadcasts on the app on my phone and a couple of days ago there was a ['post_live'] key in the json returned by the above api call (if there were in fact archived live broadcasts in the tray) but now that key never seems to exist. An api call to user_story_feed with their uid also fails to return "post live" broadcasts, despite them showing up in the app on my phone...

Web Api media_info, user_info, compat_media, compat_user not working

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here:

Python 3.6.0 :: Continuum Analytics, Inc.


Describe your issue

I have run the test_web_api, I just thought to notify the issue. Sorry for the mess. vkill is right.

Client version: 1.3.2
New login.
test_search (web.client.ClientTests) ... ok
test_client_properties (web.client.ClientTests) ... ok
test_client_errors (web.client.ClientTests) ... ok
test_client_init (web.client.ClientTests) ... ok
test_login_mock (web.client.ClientTests) ... ok
test_media_info (web.media.MediaTests) ... ERROR
test_notfound_media_info (web.media.MediaTests) ... ok
test_media_comments (web.media.MediaTests) ... ok
test_notfound_media_comments (web.media.MediaTests) ... ok
test_media_comments_noextract (web.media.MediaTests) ... ok
test_post_comment (web.media.MediaTests) ... skipped 'Modifies data.'
test_post_comment_mock (web.media.MediaTests) ... ok
test_del_comment (web.media.MediaTests) ... skipped 'Modifies data / Needs actual data.'
test_del_comment_mock (web.media.MediaTests) ... ok
test_post_like (web.media.MediaTests) ... skipped 'Modifies data'
test_post_like_mock (web.media.MediaTests) ... ok
test_delete_like (web.media.MediaTests) ... skipped 'Modifies data'
test_delete_like_mock (web.media.MediaTests) ... ok
test_carousel_media_info (web.media.MediaTests) ... ok
test_post_comment_validation_mock (web.media.MediaTests) ... ok
test_user_info (web.user.UserTests) ... ERROR
test_user_feed (web.user.UserTests) ... ok
test_notfound_user_feed (web.user.UserTests) ... ok
test_user_feed_noextract (web.user.UserTests) ... ok
test_user_followers (web.user.UserTests) ... ok
test_user_followers_noextract (web.user.UserTests) ... ok
test_user_following (web.user.UserTests) ... ok
test_friendships_create (web.user.UserTests) ... skipped 'Modifies data'
test_friendships_create_mock (web.user.UserTests) ... ok
test_friendships_destroy (web.user.UserTests) ... skipped 'Modifies data'
test_friendships_destroy_mock (web.user.UserTests) ... ok
test_compat_media (web.compatpatch.CompatPatchTests) ... ERROR
test_compat_comment (web.compatpatch.CompatPatchTests) ... ok
test_compat_user (web.compatpatch.CompatPatchTests) ... ERROR
test_compat_user_list (web.compatpatch.CompatPatchTests) ... ok
test_post_photo (web.upload.UploadTests) ... skipped 'Modifies data'
test_post_photo_mock (web.upload.UploadTests) ... ok
test_tag_feed (web.feed.FeedTests) ... ok
test_location_feed (web.feed.FeedTests) ... ok

Media_count always 0 in tag_info

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x]).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.5
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here:
Python 2.7.10

Code:

api.tag_search("instaday")

...

{
      "media_count": 12442501, 
      "name": "instaday", 
      "id": 17843910382056994
}, 

...

api.tag_info(17843910382056994)

...

{
    "profile": null, 
    "status": "ok", 
    "media_count": 0
}

Error/Debug Log:


For a new endpoint feature request, you should include the capture of the request and response.

Request:

Response:


Describe your issue

When call tag_info media_count always 0

Error Handling

Before submitting an issue, make sure you have:

  • Updated to the latest version v1.3.6

It's been some time since I updated the api due to minor cookiejar customisations, but it definitely still does nothing to handle socket.timeout, ConnectionResetError, or httplib.IncompleteRead

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

"Bug"

Python version: 3.6.0

The "error" is uncaught exceptions thrown by the underlying urllib etc. libraries, as a result of transient network conditions, so they are not easily reproducible. Any long running script that makes repeated api calls should encounter them eventually. That said, the relevant parts of the code I have which (used to) throw them most often:

from .instagram_api import (
    Client,
    ClientCookieExpiredError, ClientLoginRequiredError, ClientLoginError, ClientError,
    LiveDownloader
)
import socket  # socket.timeout
from urllib.error import URLError
from http.client import IncompleteRead
# ConnectionResetError is a builtin


class InstagramClient(object):
    def __init__(self, username, password, **kwargs):
        self.api = Client(username, password, **kwargs)
        self.api.cookie_jar.format = 'dict'

    # there should be a check for tray.get('status') == 'ok' here
    # i may change that after posting this
    def reels_tray(self):
        try:
            tray = self.api.reels_tray()
        except socket.timeout:
            return {
                "tray": [],
                "broadcasts": []
            }
        else:
            return tray

    def reels_broadcasts(self):
        tray = self.reels_tray()
        for bc in tray.get('broadcasts', ()):
            yield bc

class InstagramLiveWatcher:
    def __init__(self, client):
        self.client = client

    def get_broadcasts(self):
        try:
            yield from self.client.reels_broadcasts()
        except ClientError as e:
            print('Client Error: {} {}\n{}'.format(e.code, e, e.error_response))
            yield from ()
        except URLError as e:
            print('URL Error: {}'.format(e))
            yield from ()
        except IncompleteRead as e:
            print('Incomplete Read: {}'.format(e))
            yield from ()
        except ConnectionResetError as e:
            print('Connection Reset Error: {}'.format(e))
            yield from ()

I've also had to rewrite some methods from the LiveDownloader extension to handle errors there without crashing the thread, but that's not strictly related to this project.

Error/Debug Log:

Exception in thread InstagramLiveWatcher:
Traceback (most recent call last):
  File "/home/wlerin/.local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/wlerin/.local/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wlerin/PycharmProjects/social48/social48/instagram/live_watcher.py", line 297, in run
    for broadcast in self.get_broadcasts():
  File "/home/wlerin/PycharmProjects/social48/social48/instagram/live_watcher.py", line 277, in get_broadcasts
    yield from self.client.reels_broadcasts()
  File "/home/wlerin/PycharmProjects/social48/social48/instagram/client.py", line 175, in reels_broadcasts
    tray = self.reels_tray()
  File "/home/wlerin/PycharmProjects/social48/social48/instagram/client.py", line 165, in reels_tray
    tray = self.api.reels_tray()
  File "/home/wlerin/PycharmProjects/social48/social48/instagram/instagram_api/instagram_private_api/instagram_private_api/en
dpoints/feed.py", line 96, in reels_tray
    res = self._call_api('feed/reels_tray/', query=kwargs)
  File "/home/wlerin/PycharmProjects/social48/social48/instagram/instagram_api/instagram_private_api/instagram_private_api/cl
ient.py", line 436, in _call_api
    response_content = self._read_response(response)
  File "/home/wlerin/PycharmProjects/social48/social48/instagram/instagram_api/instagram_private_api/instagram_private_api/cl
ient.py", line 380, in _read_response
    buf = BytesIO(response.read())
  File "/home/wlerin/.local/lib/python3.6/http/client.py", line 462, in read
    s = self._safe_read(self.length)
  File "/home/wlerin/.local/lib/python3.6/http/client.py", line 612, in _safe_read
    chunk = self.fp.read(min(amt, MAXAMOUNT))
  File "/home/wlerin/.local/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/home/wlerin/.local/lib/python3.6/ssl.py", line 1002, in recv_into
    return self.read(nbytes, buffer)
  File "/home/wlerin/.local/lib/python3.6/ssl.py", line 865, in read
    return self._sslobj.read(len, buffer)
  File "/home/wlerin/.local/lib/python3.6/ssl.py", line 625, in read
    v = self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer

(I don't have logs from IncompleteRead or socket.timeout)

While it's entirely possible to catch these errors in the application, it would help development if the api either documented which errors might be thrown, or caught some of the more unusual ones and wrapped them (not necessarily in a monolithic ClientError). However, while it's harmless for the application to just retry communication interrupted by ConnectionResetError and IncompleteRead, they both seem like something the API knows enough to handle without raising an error.

(I'm also posting this to give an example of "handling" the error outside the api, related to issue #26 .)


And while I'm on the topic of errors, I don't see raise Exception in live code anymore, but there are still several places where the API is catching bare Exceptions:

private.endpoints.accounts
private.endpoints.upload
private.client

Obviously not doing this will lead to more unexpected exceptions filtering up, which is exactly the problem I brought up above, but this isn't any good either.


And, last and least of all, it would be nice if ClientError inherited from something more specific. e.g. requests' base exception class inherits from IOError

If user media has multiply photos.

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Describe your issue

I am now use instagram_web_api. And I follow the usage to get some body's picture.
Several months ago, Instagram publish multiply photos function.

If someone publish multiply photos. When I use web_api.user_feed, it will only get the first photos.
If I want to get the last, I will use web_api.media_info2.

I think I look for the documentation, but if users has multiply photos, users feed will not get all photos but first.

Is there any function that I can get user's all photos. Or can provide a judgment to define user post multiply photos in user_feed?

Help pls

{"user":{"biography":null,"blocked_by_viewer":false,"country_block":false,"external_url":null,"external_url_linkshimmed":null,"followed_by":{"count":113},"followed_by_viewer":false,"follows":{"count":94},"follows_viewer":false,"full_name":"\ud83c\uddf9\ud83c\udded March \ud83c\uddf9\ud83c\udded","has_blocked_viewer":false,"has_requested_viewer":false,"id":"5924835852","is_private":true,"is_verified":false,"mutual_followers":null,"profile_pic_url":"https://instagram.fkul7-1.fna.fbcdn.net/vp/32e9794b3ed92658f66c8f5a9858c4a0/5B13A807/t51.2885-19/s150x150/21827150_1478213012294840_7764607749345771520_n.jpg","profile_pic_url_hd":"https://instagram.fkul7-1.fna.fbcdn.net/vp/e3bc9e436ff1ee85bab397190674ea24/5B13C97F/t51.2885-19/s320x320/21827150_1478213012294840_7764607749345771520_n.jpg","requested_by_viewer":false,"username":"marchimini","connected_fb_page":null,"media":{"nodes":[],"count":84,"page_info":{"has_next_page":true,"end_cursor":"AQCtdFo6BY-gFCH44PbIYCahLjYYJV5og15okVCf9JAh9wEP28q4peWMl1RwP39PnvAkCtVXKRL6pggXA6a6OEv5YTErs8WBXrQr1SNtkI7qcQ"}},"saved_media":{"nodes":[],"count":0,"page_info":{"has_next_page":false,"end_cursor":null}},"media_collections":{"count":0,"page_info":{"has_next_page":false,"end_cursor":null},"edges":[]}},"logging_page_id":"profilePage_5924835852","show_suggested_profiles":false,"graphql":{"user":{"biography":"","blocked_by_viewer":false,"country_block":false,"external_url":null,"external_url_linkshimmed":null,"edge_followed_by":{"count":113},"followed_by_viewer":false,"edge_follow":{"count":94},"follows_viewer":false,"full_name":"\ud83c\uddf9\ud83c\udded March \ud83c\uddf9\ud83c\udded","has_blocked_viewer":false,"has_requested_viewer":false,"id":"5924835852","is_private":true,"is_verified":false,"mutual_followers":null,"profile_pic_url":"https://instagram.fkul7-1.fna.fbcdn.net/vp/32e9794b3ed92658f66c8f5a9858c4a0/5B13A807/t51.2885-19/s150x150/21827150_1478213012294840_7764607749345771520_n.jpg","profile_pic_url_hd":"https://instagram.fkul7-1.fna.fbcdn.net/vp/e3bc9e436ff1ee85bab397190674ea24/5B13C97F/t51.2885-19/s320x320/21827150_1478213012294840_7764607749345771520_n.jpg","requested_by_viewer":false,"username":"marchimini","connected_fb_page":null,"edge_owner_to_timeline_media":{"count":84,"page_info":{"has_next_page":true,"end_cursor":"AQCtdFo6BY-gFCH44PbIYCahLjYYJV5og15okVCf9JAh9wEP28q4peWMl1RwP39PnvAkCtVXKRL6pggXA6a6OEv5YTErs8WBXrQr1SNtkI7qcQ"},"edges":[]},"edge_saved_media":{"count":0,"page_info":{"has_next_page":false,"end_cursor":null},"edges":[]},"edge_media_collections":{"count":0,"page_info":{"has_next_page":false,"end_cursor":null},"edges":[]}}}}

publish on pypi

Can you publish this package on pypi for easy installation and maintenance?

how to send comment to live ?

i get this code

broadcast_id = str(broadcast_id)
endpoint = 'live/%(broadcast_id)s/comment/' % {'broadcast_id': broadcast_id}
params = {
'live_or_vod': '1',
'offset_to_video_start': '0',
'comment_text': comment_text,
'user_breadcrumb': gen_user_breadcrumb(len(comment_text)),
'idempotence_token': self.generate_uuid(),
}

res >
{"message": "Please update your Instagram app to continue commenting", "status": "fail"}

Option to save and retrieve Cookies as dicts instead of strings

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Other

Proposed rework of ClientCookieJar

I'm used to using Requests' syntax for options and cookies, and that library allows you to save and restore cookies in dict format (and thus, as JSON). By default, ClientCookieJar uses pickle.dumps, which returns a bytes object that cannot be directly stored in JSON.

I could encode it as base64 and then decode it as utf-8, but the resulting string is not human readable, and I still have to reverse these two steps to restore the cookies. Or I could dump it directly to a file in 'wb' mode, but all my config files are JSON.

Anyway, long story short, I have written a modified version of ClientCookieJar that will accept either a dict or a bytes object as its cookie_repr argument, and remember which one was used when it comes time to dump its cookies.

The format can also be set after CookieJar creation by setting the format property to "dict" or "json" for dict output, or "pickle" or "bytes" or "str" for bytes output.

Here are the proposed changes.

Archive/unarchive media isn't working

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Python 2.7.12

Code:

from instagram_private_api import Client, ClientCompatPatch

user_name = 'username'
password = 'password'

api = Client(user_name, password)
results = api.username_feed(user_name)
items = results.get('items', [])
for item in items:
    ClientCompatPatch.media(item)
    api.media_only_me(item['pk'], item['media_type'])

Error/Debug Log:

Traceback (most recent call last):
  File "/home/user/github/instagram_private_api/examples/archive.py", line 13, in <module>
    api.media_only_me(item['pk'], item['media_type'])
  File "/home/user/github/instagram_private_api/instagram_private_api/endpoints/media.py", line 506, in media_only_me
    res = self._call_api(endpoint, params=params, query={'media_type': media_type})
  File "/home/user/github/instagram_private_api/instagram_private_api/client.py", line 484, in _call_api
    raise ClientError(error_msg, e.code, error_response)
instagram_private_api.errors.ClientError: Bad Request: invalid parameters

Describe your issue

Archive/unarchive media isn't working. Error message: 'Bad Request: invalid parameters'. It looks like the api has changed.

Upcoming Instagram API changes & the future of this library

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.4.0
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


Describe your issue

I recently came across this article: https://developers.facebook.com/blog/post/2018/01/30/instagram-graph-api-updates/
I'm curious to know how much this will affect this library and its extension module (assuming it will) and if you will be keeping them up to date, if possible.

Typo. Block a user instead of Unblock a user


Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Describe your issue

Typo. Block a user instead of Unblock a user

Can not add a post description

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.4.0
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Code:

# Example code that will produce the no error reported
from instagram_private_api import Client, ClientCompatPatch

def get_image_for_post(media_path):
	with open(media_path, "rb") as img:
		f = img.read()
		b = bytearray(f)
	return b

user_name = 'user'
password = 'name'

api = Client(user_name, password)
bytear = get_image_for_post('/tmp/1/2018-02-17_00:39:28320.jpg')
api.post_photo(photo_data=bytear, caption="caption_text", size=(1080, 1080))

Describe your issue

Hey. For some time, the function of adding a description to the post has stopped working. Photo is successfully fasted, but the description is still not there. I'm not using api correctly?

IG_SIG_KEY

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Talking about instagram_private_api/instagram_private_api/constants.py
I saw the variable IG_SIG_KEY is used to generate the message authentication, I saw this variable changed during the various updates in these months.
Where have you tried it, how can I find it or how can I generate it myself?

not getting media url in tag feed

  • [ x ] Read the README and docs
  • [ x ] Searched the bugtracker for similar issues including closed ones
  • [ x ] Reviewed the sample code in tests and examples

Which client are you using?

  • [ x ] app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • [ x ] Feature request (request for a new functionality)
  • [ x ] Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.

I am not getting ["images"]["standard_resolution"]["url"] this in feed_tag but this was working in user_feed, possible way to get around this?

About uploading pictures

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • [ yes] Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • [ yes] app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • [yes ] Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here:

Code:

# Example code that will produce the error reported
from instagram_web_api import Client

web_api = Client()
user_feed_info = web_api.user_feed('1234567890', count=10)

Error/Debug Log:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "instagram_private_api/endpoints/upload.py", line 767, in post_album
    res = self._call_api(endpoint, params=params)
  File "instagram_private_api/client.py", line 501, in _call_api
    raise ClientError(error_msg, e.code, error_response)
instagram_private_api.errors.ClientError: Bad Request: Uploaded image isn't in the right format

Describe your issue

When I upload pictures, there is always such a mistake, I don't know what the format of the picture is

API Polling Rate Limit

Which client are you using?

  • app (instagram_private_api/)

Purpose of your issue?

  • Question

Describe your issue

I suppose this is a general question on how often I can make a request using the API, but for my scenario, I'm trying to view the live stream when the user starts streaming, but push notifications from mobile devices don't exist in API calls and thus it is quite difficult to know when a user is live streaming without polling reels_trayand checking the broadcast parameter.

Since I don't think I've read anything about rate-limits and polling in the documents and have a few questions in mind:

  • What would be a safe range (in seconds) to check reels_tray to catch the livestream in time?
  • In addition, should I randomly choose a time between two numbers to check so that it doesn't seem suspicious? (i.e. checking rand(10, 20) versus every 10 seconds)
  • Is subscription possible via the API?

Thanks for your work and help in advance.

ClientCompatPatch: IndexError

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here: Python 3.4.6


Describe your issue

This post:

https://www.instagram.com/p/BVRqQxmj2TA/

Has the following node information:

node: {
    comments_disabled: false,
    dimensions: {
        height: 1080,
        width: 1080
    },
    display_url: "https://scontent-lht6-1.cdninstagram.com/t51.2885-15/e35/19120472_781130132047194_8491754349737803776_n.jpg",
    edge_liked_by: {
        count: 42
    },
    edge_media_to_caption: {
        edges: [ ]
    },
    edge_media_to_comment: {
        count: 4
    },
    id: "1536194818635424960",
    is_video: false,
    owner: {
        id: "1947139030"
    },
    shortcode: "BVRqQxmj2TA",
    taken_at_timestamp: 1497348714,
    thumbnail_src: "https://scontent-lht6-1.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/19120472_781130132047194_8491754349737803776_n.jpg"
}

Notice the edge_media_to_caption key returns an empty list. This causes ClientCompatPatch to fail with an IndexError: list index out of range at https://github.com/ping/instagram_private_api/blob/master/instagram_web_api/compatpatch.py#L52 .

No DM

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.4.0
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.



Describe your issue

Hey, was wondering if there are any plans to add dm'ing and inboixng features along with better support for fingerprint generation and resuming from 2 factor/ challenges. I can add these in if desired. Also noticed that for some reason the pots login flow is commented out and that some preloing flow is missing such as msis request. Why's that?

KeyError: 'created_time' when call media_n_comments

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x]).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.5
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here:

Python 2.7.10

Code:

api.media_n_comments("1567498853622933183_1915133155")

Error/Debug Log:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/andrey/repo/social-ai/.venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/home/andrey/repo/social-ai/.venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/andrey/repo/social-ai/.venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/andrey/repo/social-ai/.venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/home/andrey/repo/social-ai/instagram_ads/management/commands/check_insta_api.py", line 92, in handle
    api.api.media_n_comments("1567498853622933183_1915133155"),
  File "/home/andrey/repo/social-ai/.venv/local/lib/python2.7/site-packages/instagram_private_api/endpoints/media.py", line 109, in media_n_comments
    return sorted(comments, key=lambda k: k['created_time'], reverse=reverse)
  File "/home/andrey/repo/social-ai/.venv/local/lib/python2.7/site-packages/instagram_private_api/endpoints/media.py", line 109, in <lambda>
    return sorted(comments, key=lambda k: k['created_time'], reverse=reverse)
KeyError: 'created_time'

For a new endpoint feature request, you should include the capture of the request and response.

Request:

Response:


Describe your issue

KeyError: 'created_time' when call media_n_comments

Transcode error: Video file does not contain duration

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • [x ] Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (
Intel)] on win32

from instagram_private_api import Client, ClientCompatPatch,MediaRatios
from instagram_private_api_extensions import media

user_name = 'xxx'
password = 'xxx'

api = Client(user_name, password)
vid_data, vid_size, vid_duration, vid_thumbnail = media.prepare_video(
    'd:\\vid.mp4', aspect_ratios=MediaRatios.standard)

api.post_video(vid_data, vid_size, vid_duration, vid_thumbnail)

Error/Debug Log:

Traceback (most recent call last):
  File "C:/Users/admin/PycharmProjects/untitled/3.py", line 17, in <module>
    api.post_video(vid_data, vid_size, vid_duration, vid_thumbnail)
  File "build\bdist.win32\egg\instagram_private_api\endpoints\upload.py", line 64
3, in post_video
  File "build\bdist.win32\egg\instagram_private_api\endpoints\upload.py", line 22
4, in configure_video
  File "build\bdist.win32\egg\instagram_private_api\endpoints\upload.py", line 46
9, in post_photo
  File "build\bdist.win32\egg\instagram_private_api\endpoints\upload.py", line 19
7, in configure
  File "build\bdist.win32\egg\instagram_private_api\client.py", line 483, in _cal
l_api
instagram_private_api.errors.ClientError: Bad Request: Transcode error: Video fil
e does not contain duration

I want ipload mp4 file to my ig account. I try use different mp4-files - same error.

How to load the full liked feed?

Before submitting an issue, make sure you have:

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Describe your issue

The docs showed that feed_liked() gives a list of liked posts, but near the end of the dict that is returned it says 'more_available': True/False. In my case it says True because I guess the number of liked posts exceeds the maximum that is accepted at once. How can I load the rest?

There is another boolean, 'auto_load_more_enabled', which is True in my case.

need a little clarification from the private API: device ids and feeds.


Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.3.6
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

Hi,

I have come accross this app which i m very delighted to use, i extensively read the docs. I have been playing with a parallel app
However i have a little question.
What's the recommended syntax to login with custom device ID? i have seen the one using Iphone but does it apply to android devices as well?

From LevPasha's API, Media are fetched from the selected Tags, along side with users who liked and other tags, what's the concise way of fetching unique media from tags, and unique users from specific tags?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.