diff --git a/README.md b/README.md index 2412d9d..9056b1d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Bluebird monitors users on X and reports new posts via Discord. Although not required, a [Discord Webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) is recommended for notifications. -An X account is required for API credentials. It is recommended to use a throwaway account due to use of the internal API. +An X account is required. It is recommended to use a throwaway account due to use of the internal API. **Environment Variables:** diff --git a/services/x.py b/services/x.py index d82f096..996ccfb 100644 --- a/services/x.py +++ b/services/x.py @@ -189,9 +189,18 @@ def GetUserPosts( continue + postId: str | None = result.get("rest_id") + + # rest_id is sometimes within a tweet object. + if not postId: + postId = result.get("tweet", {}).get("rest_id") + + if not postId: + raise Exception("rest_id is null") + posts.append( { - "postId": int(result["rest_id"]), + "postId": postId, "timestamp": int( datetime.strptime( result["legacy"]["created_at"],