'How can i exclude pinned post from user profile in praw

this is my code

username = "dijkmeneer"

user_feed = reddit.redditor(username).new()


most_recent_item = next(user_feed)


last_activity_date = datetime.utcfromtimestamp(most_recent_item.created_utc)
today = datetime.utcnow()
print(today)
print(last_activity_date)
time_delta = (today - last_activity_date)
total_seconds = time_delta.total_seconds()
minutes = total_seconds/60
hours = minutes/60
days = hours/24


print(total_seconds)
if days > 10 :
    print('last activity longer ago than 10 days')
    
else:
    print("last activity younger than 10 days")

how do I make my code so it skips over pinned posts?

I have already tried using

most_recent_item = next(x for x in user_feed if not x.stickied)

and

user_feed = reddit.redditor(username).new(sticky=False)

both don't work.

Thanks for your help in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source