Skip to main content


I think I finally got my Instagram scraper script working well. It grabs the latest post from an IG account and shares it to my GoToSocial instance. It marks the post ID so it doesn't share the same post twice. However, the problem is pinned posts. Those will always be the top post on the account, breaking the functionality of the script.

The instaloader python module can't handle pinned posts anymore because IG removed the 'pinned_for_users' value from the post metadata. So instead I have it set up to skip the top 3 posts, which is the max number of pinned posts on IG. So it just grabs the newest post after the first 3. This works for Sleep Token because they generally always have 3 pinned posts, but for accounts that only have 1 or 2 pinned posts, it will skip 1 or 2 non-pinned posts.

I'm not sure how to handle this better. If anyone has any ideas, I'm open to suggestions.

#python #scripting #AskFedi

in reply to Jcrabapple 💙

I havent looked at the scripts at all, but does it not have a date field on the post? If so, you could just compare the top 3-4 posts to see the date order and throw out the ones that are out of sequence.
in reply to James Wynn 🧐

@jameswynn hmm yeah that might work. The metadata includes the date. Since the script is running hourly I could have it skip posts that aren't from today or yesterday.