instagrapi icon indicating copy to clipboard operation
instagrapi copied to clipboard

fix/core-issues

Open Barkasj opened this issue 7 months ago • 0 comments

I've fixed two critical bugs related to auth and reel uploads.

  1. Auth: I ensured TwoFactorRequired is raised for 2FA challenges.

    • I modified instagrapi/mixins/private.py within the _send_private_request method's HTTP 400 error handling.
    • If the JSON response from a failed login attempt contains two_factor_info, the TwoFactorRequired exception is now reliably raised.
    • This addresses GitHub Issue #2195, ensuring that the two-factor authentication flow can be correctly initiated by client applications.
  2. Upload: I made overlap_duration_in_ms dynamic for reels with music.

    • I modified instagrapi/mixins/clip.py in the clip_upload_as_reel_with_music method.
    • The overlap_duration_in_ms parameter within music_params is now dynamically calculated as int(video.duration * 1000) based on the actual video duration.
    • This replaces a previously hardcoded value (15000ms) and aims to resolve 500 server errors reported in GitHub Issue #2190 by providing more accurate metadata for reels uploaded with accompanying music.

These changes address key issues to improve the library's stability for authentication and media uploading. I've also presented and discussed a development plan with you for further feature enhancements.

Barkasj avatar May 21 '25 23:05 Barkasj