Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ All notable changes to PostParse are documented here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
[Semantic Versioning](https://semver.org/) (pre-1.0: minor versions may break).

## [Unreleased]

### Fixed

- **Instagram session check**: the saved session is no longer verified with
instaloader's `test_login()` (legacy GraphQL `query_hash` d6f4427…, which
Instagram answers with 401 "Please wait a few minutes", and which reported
every error as "not logged in"). The check now reads the `sessionid` /
`ds_user_id` cookies and asks `api/v1/users/<id>/info/` once (single
connection attempt). A throttled or failed check raises the new
`InstagramSessionCheckFailed` (a subclass of `InstagramRateLimited`, exit
code 3) and **never falls back to a password login**; the session file is
left untouched. The password login is only used when the session is
positively logged out.
- **Instagram saved feed**: collected through the private API
(`api/v1/feed/saved/posts/`, paginated with `max_id`) instead of
`Profile.own_profile().get_saved_posts()`, which use legacy GraphQL
`query_hash` queries. Owners, comment counts and carousel video children
(with durations) are read from the private API media structs.
- `AbortDownloadException` (checkpoint, login redirect) during a run is mapped
to `InstagramAuthRequired`.

## [0.2.0] - 2026-10-26

A rewrite of the storage, LLM, collection and API layers. The CLI command names
Expand Down
11 changes: 11 additions & 0 deletions docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ postparse db reindex
then retry. If the saved session keeps failing, delete
`data/sessions/instagram_<username>` and log in again (needs
`INSTAGRAM_PASSWORD`).
* **"Instagram did not confirm the saved session"**: exit code 3. The session
check (one request to `i.instagram.com/api/v1/users/<id>/info/`, a single
attempt) was throttled (401 "Please wait a few minutes", 429) or Instagram
was unreachable. This says nothing about the session itself, so **no password
login is attempted** and the session file is left untouched; nothing was
collected or lost. Wait a few hours and retry. A password login (with
`INSTAGRAM_PASSWORD`) only happens when the check positively says the session
is logged out (login redirect, `login_required`, session of another account,
no `sessionid` cookie) or when there is no session file. Repeated scripted
password logins are what triggers checkpoints, so do not delete a session
file just because of this message.
* **Rate limit (429) / soft block**: exit code 3. Instagram sometimes answers a
soft-blocked session with errors that look like deleted posts; the
transcription circuit breaker stops after
Expand Down
2 changes: 2 additions & 0 deletions src/postparse/collectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
CredentialsMissing,
InstagramAuthRequired,
InstagramRateLimited,
InstagramSessionCheckFailed,
ProgressCallback,
ProgressEvent,
RateLimited,
Expand All @@ -32,6 +33,7 @@
"InstagramAuthRequired",
"InstagramCredentials",
"InstagramRateLimited",
"InstagramSessionCheckFailed",
"ProgressCallback",
"ProgressEvent",
"RateLimited",
Expand Down
19 changes: 19 additions & 0 deletions src/postparse/collectors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"CredentialsMissing",
"InstagramAuthRequired",
"InstagramRateLimited",
"InstagramSessionCheckFailed",
"ProgressCallback",
"ProgressEvent",
"RateLimited",
Expand Down Expand Up @@ -111,6 +112,24 @@ def __init__(self, detail: str | None = None, retry_after: float | None = None)
super().__init__(f"{message} ({detail})" if detail else message, retry_after)


class InstagramSessionCheckFailed(InstagramRateLimited):
"""The saved Instagram session could not be verified (throttled or unreachable).

Raised instead of falling back to a password login: Instagram answered the
session check with a throttle ("please wait a few minutes", 401/429) or did
not answer at all, which says nothing about the session itself. Repeated
scripted password logins are what triggers checkpoints, so none is tried.
"""

def __init__(self, detail: str | None = None, retry_after: float | None = None) -> None:
message = (
"Instagram did not confirm the saved session (throttled or unreachable). "
"No password login was attempted, the session file was kept and nothing "
"was lost; wait a while (ideally hours) before retrying."
)
RateLimited.__init__(self, f"{message} ({detail})" if detail else message, retry_after)


class TelegramRateLimited(RateLimited):
"""Telegram FloodWait longer than the client's ``flood_sleep_threshold``."""

Expand Down
Loading
Loading